Fix somes selections issues (#771)

* SelectLeft on the last character is now possible

* SelectLeft on the last character is now possible

* CursorRight on selection places the cursor after the last selected character

* SelectRight on the last character do not select the last character and do nothing
This commit is contained in:
Yannick A
2017-08-09 17:52:38 +02:00
committed by Zachary Yedidia
parent fcb09556b1
commit 7fe8d73473

View File

@@ -249,7 +249,7 @@ func (v *View) CursorRight(usePlugin bool) bool {
}
if v.Cursor.HasSelection() {
v.Cursor.Loc = v.Cursor.CurSelection[1].Move(-1, v.Buf)
v.Cursor.Loc = v.Cursor.CurSelection[1]
v.Cursor.ResetSelection()
v.Cursor.StoreVisualX()
} else {
@@ -347,7 +347,7 @@ func (v *View) SelectLeft(usePlugin bool) bool {
}
loc := v.Cursor.Loc
count := v.Buf.End().Move(-1, v.Buf)
count := v.Buf.End()
if loc.GreaterThan(count) {
loc = count
}
@@ -370,7 +370,7 @@ func (v *View) SelectRight(usePlugin bool) bool {
}
loc := v.Cursor.Loc
count := v.Buf.End().Move(-1, v.Buf)
count := v.Buf.End()
if loc.GreaterThan(count) {
loc = count
}