commit befe2da495bf24d651c81bb35fbcda5976f09077
Author: Enrico Forestieri <[email protected]>
Date:   Wed Jun 28 21:17:26 2023 +0200

    Honor pending spaces in InsetMathChar::write
    
    The InsetMathChar::write() method directly accesses the otexrowstream
    underlying the TeXMathStream class for writing a character, thus
    shortcircuiting the mechanism that allows to separate a macro from the
    following material. It has to do so because directly writing a char_type
    would cause printing its numerical value instead of the corresponding
    unicode character in systems where char_type is typedef'd to uint32_t.
    
    This problem has been uncovered by [7441172d/lyxgit] because each atom
    of a mathed cell was being separately written to the output instead of
    using the lyx::write() method in MathExtern.cpp that simply converts
    everything to a docstring. As InsetMathChar::write() is the only method
    bypassing the TeXMathStream machanism, it is simpler teaching it to
    honor the pending space instead of modifying the code in InsetMathColor.
    
    This commit amends 7441172d.
---
 src/mathed/InsetMathChar.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp
index 483bbb8..d923d04 100644
--- a/src/mathed/InsetMathChar.cpp
+++ b/src/mathed/InsetMathChar.cpp
@@ -195,6 +195,11 @@ void InsetMathChar::drawT(TextPainter & pain, int x, int 
y) const
 
 void InsetMathChar::write(TeXMathStream & os) const
 {
+       if (os.latex() && os.pendingSpace()) {
+               if (isAlphaASCII(char_))
+                       os.os() << ' ';
+               os.pendingSpace(false);
+       }
        os.os().put(char_);
 }
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to