commit 307a2f91ada54af85bfc70d35bd42a61a49de8ef
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Mar 17 16:42:39 2022 +0100

    Revert part of 503c7c16: InsetMathNest:edit resets anchor.
    
    Fixes bug reported here:
    https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg217265.html
    
    1. Start a new document.
    2. Start a math inset and inside put "1+2".
    3. Put the cursor to the right of "+".
    4. Press <Shift> + L three times. This will select the entire math inset
       (as expected).
    5. Press <Shift> + R.
    
    Before 503c7c16, the selection inside the math inset was preserved.
    After 503c7c16, it is lost.
    
    The problem is that InsetMathNest does too much for our needs and
    resets the anchor (why, I do not know). Therefore, it is better to
    duplicate the code.
---
 src/mathed/InsetMathHull.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 8fd2bdd..8b63c73 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2254,7 +2254,10 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring 
const & arg)
 
 void InsetMathHull::edit(Cursor & cur, bool front, EntryDirection entry_from)
 {
-       InsetMathNest::edit(cur, front, entry_from);
+       cur.push(*this);
+       bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_LEFT ||
+               (entry_from == Inset::ENTRY_DIRECTION_IGNORE && front));
+       enter_front ? idxFirst(cur) : idxLast(cur);
        // The inset formula dimension is not necessarily the same as the
        // one of the instant preview image, so we have to indicate to the
        // BufferView that a metrics update is needed.
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to