mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-16 22:10:26 +00:00
actions: Prevent additional cursor move down on Cursor(Page)Down
This is needed to not move two lines below the last visual selection when it has end behind the new line character.
This commit is contained in:
parent
50639015d7
commit
2c4754d484
1 changed files with 5 additions and 1 deletions
|
|
@ -256,9 +256,10 @@ func (h *BufPane) CursorUp() bool {
|
|||
func (h *BufPane) CursorDown() bool {
|
||||
selectionEndNewline := h.Cursor.HasSelection() && h.Cursor.CurSelection[1].X == 0
|
||||
h.Cursor.Deselect(false)
|
||||
h.MoveCursorDown(1)
|
||||
if selectionEndNewline {
|
||||
h.Cursor.Start()
|
||||
} else {
|
||||
h.MoveCursorDown(1)
|
||||
}
|
||||
h.Relocate()
|
||||
return true
|
||||
|
|
@ -1739,6 +1740,9 @@ func (h *BufPane) CursorPageDown() bool {
|
|||
h.Cursor.Deselect(false)
|
||||
pageOverlap := int(h.Buf.Settings["pageoverlap"].(float64))
|
||||
scrollAmount := h.BufView().Height - pageOverlap
|
||||
if selectionEndNewline {
|
||||
scrollAmount--
|
||||
}
|
||||
h.MoveCursorDown(scrollAmount)
|
||||
if h.Cursor.Num == 0 {
|
||||
h.ScrollDown(scrollAmount)
|
||||
|
|
|
|||
Loading…
Reference in a new issue