commit b3cdb64198038842df116498c50b781531208768
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Aug 28 17:24:58 2026 +0200

    Fix cursor position when going to previous cell in a macro template
    
    Additionally, move the getStatus handling of
    LFUN_CELL_BACKWARD/FORWARD where it belongs.
    
    Fixes bug #13237.
---
 src/mathed/InsetMathGrid.cpp |  5 -----
 src/mathed/InsetMathNest.cpp | 12 +++++++++++-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index dde5672cc8..add5dc4535 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1879,11 +1879,6 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest 
const & cmd,
                status.setEnabled(cur.idx() != cur.lastidx());
                return true;
 
-       case LFUN_CELL_BACKWARD:
-       case LFUN_CELL_FORWARD:
-               status.setEnabled(true);
-               return true;
-
        default:
                break;
        }
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 1ba250ac5e..94715cf8b6 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -225,7 +225,12 @@ bool InsetMathNest::idxPrev(Cursor & cur) const
 
 bool InsetMathNest::idxBackward(Cursor & cur) const
 {
-       return idxPrev(cur);
+       LASSERT(&cur.inset() == this, return false);
+       if (cur.idx() == 0)
+               return false;
+       --cur.idx();
+       cur.pos() = cur.lastpos();
+       return true;
 }
 
 
@@ -1863,6 +1868,11 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest 
const & cmd,
                return true;
        }
 
+       case LFUN_CELL_BACKWARD:
+       case LFUN_CELL_FORWARD:
+               flag.setEnabled(true);
+               return true;
+
        default:
                ret = false;
                break;
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to