Correct word movement behavior

This commit is contained in:
Zachary Yedidia
2016-04-26 19:53:43 -04:00
parent 6c99eea610
commit 84a844994a
2 changed files with 14 additions and 14 deletions

View File

@@ -207,7 +207,7 @@ func (c *Cursor) AddWordToSelection() {
func (c *Cursor) SelectTo(loc int) {
if loc > c.origSelection[0] {
c.curSelection[0] = c.origSelection[0]
c.curSelection[1] = loc + 1
c.curSelection[1] = loc
} else {
c.curSelection[0] = loc
c.curSelection[1] = c.origSelection[0] + 1
@@ -242,7 +242,7 @@ func (c *Cursor) RuneUnder(x int) rune {
return '\n'
}
if x >= len(line) {
x = len(line) - 1
return '\n'
} else if x < 0 {
x = 0
}