mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 06:30:28 +09:00
Add bindings for shiftup and shiftdown
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user