From 43dc893f3f79e6bd5a57b20f95fb0de8ee4997be Mon Sep 17 00:00:00 2001 From: Jan Sundermeyer Date: Tue, 7 Nov 2023 19:12:57 +0100 Subject: [PATCH] clean up command stack if an argument is closed fix #3292 --- src/latexparser/latexparsing.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/latexparser/latexparsing.cpp b/src/latexparser/latexparsing.cpp index 3e8cbc548b..a1cbc5be35 100644 --- a/src/latexparser/latexparsing.cpp +++ b/src/latexparser/latexparsing.cpp @@ -582,6 +582,10 @@ bool latexDetermineContexts2(QDocumentLineHandle *dlh, TokenStack &stack, Comman tk.subtype=tk1.subtype; level=tk1.level; // restore original level lexed.append(tk); + // clean up command stack (unrealized arguments) + while (!commandStack.isEmpty() && commandStack.top().level > level) { + commandStack.pop(); + } } if (!commandStack.isEmpty() && commandStack.top().level == level) { CommandDescription cd = commandStack.top();