[LyX/master] inset-forall: clear selection after each action

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Feb 20 17:39:02 UTC 2022


commit 3b28ac46376cfdb10fbc67a45fe1c83d87043d08
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Feb 20 19:07:58 2022 +0100

    inset-forall: clear selection after each action
    
    This avoid a crash when doing
      command-sequence inset-forall Caption char-delete-forward; statistics; undo
    in the user guide when a malformed selection is created.
    
    The selection happens here because char-delete-forward will select the
    caption instead of deleting it if the "force" parameter is not given.
    This is a poor API IMO, it is the plain <del> action that should use a
    special parameter.
---
 src/BufferView.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 2bf7d2a..06ffb38 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2081,6 +2081,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 				if (insname == name || name == from_utf8("*")) {
 					curs.recordUndo();
 					lyx::dispatch(fr, dr);
+					// we do not want to remember selection here
+					curs.clearSelection();
 					++iterations;
 					break;
 				}


More information about the lyx-cvs mailing list