From 85f030a03173252dbb9d3ba75853ad48f43a8a8f Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 21 Oct 2021 22:36:29 +0200 Subject: [PATCH] Let Tab go out of inset when no cycling is possible Adapted patch from Enrico by adding S-Tab handling. Fixes bug #11085 --- src/mathed/InsetMathNest.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 7e763b7e80..b62505a8b8 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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; -- 2.39.5