]> git.lyx.org Git - features.git/commitdiff
Let Tab go out of inset when no cycling is possible
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 21 Oct 2021 20:36:29 +0000 (22:36 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 21 Oct 2021 20:42:40 +0000 (22:42 +0200)
Adapted patch from Enrico by adding S-Tab handling.

Fixes bug #11085

src/mathed/InsetMathNest.cpp

index 7e763b7e8000d40200a721c1e04b747ffce40443..b62505a8b836b241d7caa59f91c54da0d953b096 100644 (file)
@@ -780,8 +780,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.clearTargetX();
                cur.macroModeClose();
                if (!cur.inset().idxNext(cur)) {
-                       cur.idx() = firstIdx();
-                       cur.pos() = 0;
+                       if (cur.lastidx() == 0)
+                               cur.popForward();
+                       else {
+                               cur.idx() = firstIdx();
+                               cur.pos() = 0;
+                       }
                }
                break;
 
@@ -791,8 +795,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.clearTargetX();
                cur.macroModeClose();
                if (!cur.inset().idxPrev(cur)) {
-                       cur.idx() = cur.lastidx();
-                       cur.pos() = lyxrc.mac_like_cursor_movement ? cur.lastpos() : 0;
+                       if (cur.lastidx() == 0)
+                               cur.popBackward();
+                       else {
+                               cur.idx() = cur.lastidx();
+                               cur.pos() = lyxrc.mac_like_cursor_movement ? cur.lastpos() : 0;
+                       }
                }
                break;