commit 13a34d6cd1bbf2a93d5b51624de7085d594cf8fa
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.
    
    (cherry picked from commit b45a957929a78cefc729a0fa984214eb83357d42)
---
 po/cs.gmo                     | Bin 627180 -> 627292 bytes
 po/de.gmo                     | Bin 653622 -> 653742 bytes
 po/sk.gmo                     | Bin 636629 -> 636898 bytes
 src/mathed/InsetMathMacro.cpp |   2 ++
 status.24x                    |   2 ++
 5 files changed, 4 insertions(+)

diff --git a/po/cs.gmo b/po/cs.gmo
index 77e6cdb0b6..a2e7997798 100644
Binary files a/po/cs.gmo and b/po/cs.gmo differ
diff --git a/po/de.gmo b/po/de.gmo
index 9fc86c4547..6677f06738 100644
Binary files a/po/de.gmo and b/po/de.gmo differ
diff --git a/po/sk.gmo b/po/sk.gmo
index 848fb84684..be2c5419d8 100644
Binary files a/po/sk.gmo and b/po/sk.gmo differ
diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index a90bf87f5e..9caf4853dc 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -1078,6 +1078,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);
        d->expanded_ = MathData();
diff --git a/status.24x b/status.24x
index 78494339b1..421226bba1 100644
--- a/status.24x
+++ b/status.24x
@@ -75,6 +75,8 @@ What's new
 
 * INTERNALS
 
+- Fix case where insets do not have proper information about current buffer
+  (bug 12682).
 
 
 * DOCUMENTATION AND LOCALIZATION
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to