From 19c69f9eaad7420896b5dc46b6d29f2d5de80010 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sat, 8 Jun 2024 19:14:30 +0200 Subject: [PATCH] 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. --- internal/action/actions.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/action/actions.go b/internal/action/actions.go index 79bff07d..45c7c916 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -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