mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-16 22:10:26 +00:00
actions: On Cursor(Page)Down with selection of newline place cursor to start
This commit is contained in:
parent
b881bf5606
commit
3a16197da7
1 changed files with 8 additions and 0 deletions
|
|
@ -254,8 +254,12 @@ func (h *BufPane) CursorUp() bool {
|
|||
|
||||
// CursorDown moves the cursor down
|
||||
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()
|
||||
}
|
||||
h.Relocate()
|
||||
return true
|
||||
}
|
||||
|
|
@ -1732,6 +1736,7 @@ func (h *BufPane) CursorPageUp() bool {
|
|||
// CursorPageDown places the cursor a page down,
|
||||
// moving the view to keep cursor at the same relative position in the view
|
||||
func (h *BufPane) CursorPageDown() bool {
|
||||
selectionEndNewline := h.Cursor.HasSelection() && h.Cursor.CurSelection[1].X == 0
|
||||
h.Cursor.Deselect(false)
|
||||
pageOverlap := int(h.Buf.Settings["pageoverlap"].(float64))
|
||||
scrollAmount := h.BufView().Height - pageOverlap
|
||||
|
|
@ -1740,6 +1745,9 @@ func (h *BufPane) CursorPageDown() bool {
|
|||
h.ScrollDown(scrollAmount)
|
||||
h.ScrollAdjust()
|
||||
}
|
||||
if selectionEndNewline {
|
||||
h.Cursor.Start()
|
||||
}
|
||||
h.Relocate()
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue