From df8d5285bfa806b1b09734beb8adbdb5edb53a38 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 9 Jun 2024 00:24:54 +0200 Subject: [PATCH] Fix Cursor{Up,Down} after CopyLine After executing the CopyLine action, moving cursor up or down unexpectedly moves cursor to the beginning of the line, since its LastVisualX value is lost in the selection/deselection manipulations. Fix this by restoring the original LastVisualX. --- internal/action/actions.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/action/actions.go b/internal/action/actions.go index 45c7c916..7b367011 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1179,6 +1179,7 @@ func (h *BufPane) CopyLine() bool { return false } origLoc := h.Cursor.Loc + origLastVisualX := h.Cursor.LastVisualX h.Cursor.SelectLine() h.Cursor.CopySelection(clipboard.ClipboardReg) h.freshClip = true @@ -1186,6 +1187,7 @@ func (h *BufPane) CopyLine() bool { h.Cursor.Deselect(true) h.Cursor.Loc = origLoc + h.Cursor.LastVisualX = origLastVisualX h.Relocate() return true }