Fix Cursor{Up,Down} after DeleteLine and CutLine

After executing CutLine or DeleteLine action, the cursor is at the
beginning of a line (as expected) but then moving the cursor up or down
moves it to an unexpected location in the middle of the next or previous
line. Fix this by updating the cursor's LastVisualX.
This commit is contained in:
Dmytro Maluka
2024-06-08 19:14:30 +02:00
parent 9eb8782ff2
commit 19c69f9eaa

View File

@@ -1211,6 +1211,7 @@ func (h *BufPane) CutLine() bool {
h.lastCutTime = time.Now()
h.Cursor.DeleteSelection()
h.Cursor.ResetSelection()
h.Cursor.StoreVisualX()
InfoBar.Message("Cut line")
h.Relocate()
return true
@@ -1256,6 +1257,7 @@ func (h *BufPane) DeleteLine() bool {
}
h.Cursor.DeleteSelection()
h.Cursor.ResetSelection()
h.Cursor.StoreVisualX()
InfoBar.Message("Deleted line")
h.Relocate()
return true