mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-06 21:00:19 +09:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user