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

    Catcode check: consider groups as catcode changes have local scope
    
    (cherry picked from commit 55a474652fc5406fb63346f0a35041cc0a955870)
---
 src/BufferParams.cpp | 12 ++++++++++--
 status.25x           |  3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index d32262054d..963cb74fb2 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2100,6 +2100,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();
@@ -2113,12 +2114,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;
diff --git a/status.25x b/status.25x
index a48b91d646..203e796aef 100644
--- a/status.25x
+++ b/status.25x
@@ -48,6 +48,9 @@ What's new
 
 - Handle biblatex error on wrong bbl file (bug 13360).
 
+- Calibrate the catcode mismatch check introduced in LyX 2.5.3 which
+  produced false positives with grouped catcode changes.
+
 
 * USER INTERFACE
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to