On Tue, Oct 20, 2009 at 01:11:37AM +0200, for...@lyx.org wrote:

> Author: forenr
> Date: Tue Oct 20 01:11:36 2009
> New Revision: 31680
> URL: http://www.lyx.org/trac/changeset/31680
> 
> Log:
> Fix bug #6284: missing space between # and text in math mode when using \mbox

Jürgen?

> Modified:
>    lyx-devel/trunk/src/mathed/MathParser.cpp
> 
> Modified: lyx-devel/trunk/src/mathed/MathParser.cpp
> ==============================================================================
> --- lyx-devel/trunk/src/mathed/MathParser.cpp Mon Oct 19 17:35:55 2009        
> (r31679)
> +++ lyx-devel/trunk/src/mathed/MathParser.cpp Tue Oct 20 01:11:36 2009        
> (r31680)
> @@ -1777,8 +1777,15 @@
>                               if (mode == InsetMath::TEXT_MODE) {
>                                       int num_tokens = 0;
>                                       docstring cmd = prevToken().asInput();
> -                                     skipSpaces();
> +                                     // Check whether we have a macro
> +                                     // argument, taking into account that
> +                                     // it may come after some spaces.
>                                       CatCode cat = nextToken().cat();
> +                                     while (cat == catSpace) {
> +                                             getToken();
> +                                             ++num_tokens;
> +                                             cat = nextToken().cat();
> +                                     }
>                                       if (cat == catBegin) {
>                                               int count = 0;
>                                               while (good() && (count || cat 
> != catEnd)) {
> @@ -1790,6 +1797,12 @@
>                                                       else if (cat == catEnd)
>                                                               --count;
>                                               }
> +                                     } else {
> +                                             // No macro argument is present,
> +                                             // so put back the spaces that
> +                                             // we may have read.
> +                                             for (; num_tokens; --num_tokens)
> +                                                     putback();
>                                       }
>                                       bool is_combining;
>                                       char_type c =
> 

-- 
Enrico

Reply via email to