mirror of
https://github.com/zyedidia/micro
synced 2024-11-05 17:41:24 +00:00
Add bindings for shiftup and shiftdown
This commit is contained in:
parent
536c96237c
commit
18b0b3e97d
1 changed files with 26 additions and 0 deletions
|
@ -29,6 +29,8 @@ func InitBindings() {
|
|||
"CursorEnd": (*View).CursorEnd,
|
||||
"SelectToStart": (*View).SelectToStart,
|
||||
"SelectToEnd": (*View).SelectToEnd,
|
||||
"SelectUp": (*View).SelectUp,
|
||||
"SelectDown": (*View).SelectDown,
|
||||
"SelectLeft": (*View).SelectLeft,
|
||||
"SelectRight": (*View).SelectRight,
|
||||
"WordRight": (*View).WordRight,
|
||||
|
@ -245,6 +247,8 @@ func DefaultBindings() map[string]string {
|
|||
"Down": "CursorDown",
|
||||
"Right": "CursorRight",
|
||||
"Left": "CursorLeft",
|
||||
"ShiftUp": "SelectUp",
|
||||
"ShiftDown": "SelectDown",
|
||||
"ShiftLeft": "SelectLeft",
|
||||
"ShiftRight": "SelectRight",
|
||||
"AltLeft": "WordLeft",
|
||||
|
@ -335,6 +339,28 @@ func (v *View) WordLeft() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// SelectUp selects up one line
|
||||
func (v *View) SelectUp() bool {
|
||||
loc := v.cursor.Loc()
|
||||
if !v.cursor.HasSelection() {
|
||||
v.cursor.origSelection[0] = loc
|
||||
}
|
||||
v.cursor.Up()
|
||||
v.cursor.SelectTo(v.cursor.Loc())
|
||||
return true
|
||||
}
|
||||
|
||||
// SelectUp selects down one line
|
||||
func (v *View) SelectDown() bool {
|
||||
loc := v.cursor.Loc()
|
||||
if !v.cursor.HasSelection() {
|
||||
v.cursor.origSelection[0] = loc
|
||||
}
|
||||
v.cursor.Down()
|
||||
v.cursor.SelectTo(v.cursor.Loc())
|
||||
return true
|
||||
}
|
||||
|
||||
// SelectLeft selects the character to the left of the cursor
|
||||
func (v *View) SelectLeft() bool {
|
||||
loc := v.cursor.Loc()
|
||||
|
|
Loading…
Reference in a new issue