]> git.lyx.org Git - lyx.git/commitdiff
Set buffer_ correctly when inseting a math macro over a selection
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 25 Apr 2024 12:28:10 +0000 (14:28 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 25 Apr 2024 12:32:18 +0000 (14:32 +0200)
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

index 9d67c7807796236b6ee9555166920aa87bc069ba..03794c6632a644f3d11acd4b3a22ab22e97c5a05 100644 (file)
@@ -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_);