commit c071cfdc402bd051cbfe5ae57054247a1975700f
Author: Enrico Forestieri <[email protected]>
Date:   Wed Jul 2 01:56:56 2025 +0200

    Fix bug #8446
---
 src/Cursor.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 526ed27402..c389c807dc 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -1574,14 +1574,21 @@ void Cursor::niceInsert(MathAtom const & t)
                asMathData(safe, md);
                prevMath().cell(idx).insert(0, md);
                editInsertedInset();
-       } else if (t->asMacroInset() && !safe.empty()) {
+       } else if (t->asMacroInset()) {
                MathData md(buffer());
-               asMathData(safe, md);
+               if (!safe.empty())
+                       asMathData(safe, md);
                docstring const name = t->asMacroInset()->name();
                MacroData const * data = buffer()->getMacro(name);
-               if (data && data->numargs() - data->optionals() > 0) {
+               int npar = data ? data->numargs() - data->optionals() : 0;
+               if (npar > 0) {
                        plainInsert(MathAtom(new InsetMathBrace(buffer(), md)));
                        posBackward();
+                       md.clear();
+                       for (int i = 1; i < npar; ++i) {
+                               plainInsert(MathAtom(new 
InsetMathBrace(buffer(), md)));
+                               posBackward();
+                       }
                }
        }
 }
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to