mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-17 12:30:23 +09:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user