Is there a reason to do the following for outline-up and outline-down?

  setCursor(cur, cur.pit(), 0);

It does not seem to be necessary in my testing, but I'm wondering if
there's a case I'm missing. Or perhaps it is not necessary but is
desired behavior for some reason?

It has been this way for a long time, at least since 71f356c3.

Attached is a patch to remove it so that the cursor position does not
change when executing those actions.

Scott
From 452256b432268ffd69abc9c615d4f8131b1357ca Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Mon, 9 Mar 2020 20:01:53 -0400
Subject: [PATCH] outline-up/down: preserve cursor's position

There is no need to set the cursor's position to the beginning of
the line.

This change does not affect the behavior of using the buttons in the
Outliner pane, but is useful for using the keyboard shortcuts.
---
 src/Text3.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index 81b01324ad..616ff31c2f 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2765,14 +2765,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
 	case LFUN_OUTLINE_UP:
 		outline(OutlineUp, cur, this);
-		setCursor(cur, cur.pit(), 0);
 		cur.forceBufferUpdate();
 		needsUpdate = true;
 		break;
 
 	case LFUN_OUTLINE_DOWN:
 		outline(OutlineDown, cur, this);
-		setCursor(cur, cur.pit(), 0);
 		cur.forceBufferUpdate();
 		needsUpdate = true;
 		break;
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to