On Tue, Sep 02, 2008 at 08:02:09PM -0000, [EMAIL PROTECTED] wrote:
> Author: forenr
> Date: Tue Sep  2 22:02:08 2008
> New Revision: 26287
> 
> URL: http://www.lyx.org/trac/changeset/26287
> Log:
> Take into account the latex encoding when generating math preview snippets.
> 
> Modified:
>     lyx-devel/trunk/src/mathed/InsetMathHull.cpp
> 
> Modified: lyx-devel/trunk/src/mathed/InsetMathHull.cpp
> URL: 
> http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/InsetMathHull.cpp?rev=26287
> ==============================================================================
> --- lyx-devel/trunk/src/mathed/InsetMathHull.cpp (original)
> +++ lyx-devel/trunk/src/mathed/InsetMathHull.cpp Tue Sep  2 22:02:08 2008
> @@ -35,6 +35,7 @@
>  #include "Cursor.h"
>  #include "DispatchResult.h"
>  #include "FuncRequest.h"
> +#include "Language.h"
>  #include "LyXRC.h"
>  #include "OutputParams.h"
>  #include "ParIterator.h"
> @@ -445,7 +446,12 @@
>  static docstring latexString(InsetMathHull const & inset)
>  {
>       odocstringstream ls;
> -     WriteStream wi(ls, false, false, false);
> +     // This has to be static, because a preview snippet containing math
> +     // in text mode (such as $\text{$\phi$}$) gets processed twice. The
> +     // first time as a whole, and the second time only the inner math.
> +     // In this last case inset.buffer() would be invalid.
> +     static Encoding const * encoding = 
> inset.buffer().language()->encoding();
> +     WriteStream wi(ls, false, true, false, encoding);

If you load a buffer with a different encoding afterwards, what will
happen?

Andre'

Reply via email to