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.
This commit is contained in:
Dmytro Maluka
2024-06-09 00:24:54 +02:00
parent 19c69f9eaa
commit df8d5285bf

View File

@@ -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
}