commit b45a957929a78cefc729a0fa984214eb83357d42
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Apr 25 14:28:10 2024 +0200

    Set buffer_ correctly when inseting a math macro over a selection
    
    The code that handles this special macro insertion (in
    Cursor::mathMacroClose())) is very weird: it inserts the contents of
    the macro _after_ the macro and later, since the macro is 'greedy', it
    will eat this contents and put it in its first macro cell.
    
    Does it make sense to you? It does not ake sense to me either. Anyway,
    this is the point where one should make sure that the buffer is set.
    
    Fixes ticket #12682.
---
 src/mathed/InsetMathMacro.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 9d67c78077..03794c6632 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -1080,6 +1080,8 @@ void InsetMathMacro::attachArguments(vector<MathData> 
const & args, size_t arity
 {
        LASSERT(d->displayMode_ == DISPLAY_NORMAL, return);
        cells_ = args;
+       for (auto & cell : cells_)
+               cell.setBuffer(*buffer_);
        d->attachedArgsNum_ = args.size();
        cells_.resize(arity, MathData(buffer_));
        d->expanded_ = MathData(buffer_);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to