Fix differences between selection with keys and with mouse

Fixes #89
This commit is contained in:
Zachary Yedidia
2016-04-30 16:50:43 -04:00
parent 9ad2820e5e
commit 539d4b1167
3 changed files with 12 additions and 2 deletions

View File

@@ -293,14 +293,20 @@ func DefaultBindings() map[string]string {
// CursorUp moves the cursor up
func (v *View) CursorUp() bool {
v.cursor.ResetSelection()
if v.cursor.HasSelection() {
v.cursor.SetLoc(v.cursor.curSelection[0])
v.cursor.ResetSelection()
}
v.cursor.Up()
return true
}
// CursorDown moves the cursor down
func (v *View) CursorDown() bool {
v.cursor.ResetSelection()
if v.cursor.HasSelection() {
v.cursor.SetLoc(v.cursor.curSelection[1])
v.cursor.ResetSelection()
}
v.cursor.Down()
return true
}