commit 55a474652fc5406fb63346f0a35041cc0a955870
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Sep 22 09:33:16 2026 +0200

    Catcode check: consider groups as catcode changes have local scope
---
 src/BufferParams.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 5f05338cbe..16d6cdea5e 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2295,6 +2295,7 @@ bool isAtOther(docstring const & passage, docstring & 
context)
        lex.setCommentChar('%');
        int lineno = lex.lineNumber();
        int prev_lineno = lineno;
+       int group_level = 0;
 
        while (lex.isOK()) {
                lineno = lex.lineNumber();
@@ -2308,12 +2309,19 @@ bool isAtOther(docstring const & passage, docstring & 
context)
                        context += from_ascii("\n");
                prev_lineno = lineno;
 
-               if (token == "\\makeatletter") {
+               // catcode changes are local, so skip those inside
+               // local contexts (groups)
+               if (contains(token, '{'))
+                       ++group_level;
+               if (contains(token, '}'))
+                       --group_level;
+
+               if (token == "\\makeatletter" && group_level == 0) {
                        context = from_ascii(token);
                        cc = false;
                        continue;
                }
-               if (token == "\\makeatother") {
+               if (token == "\\makeatother" && group_level == 0) {
                        context += from_ascii(token);
                        cc = true;
                        continue;
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to