This commit is contained in:
Zachary Yedidia
2017-08-24 13:15:01 -04:00
8 changed files with 95 additions and 22 deletions

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
}

View File

@@ -249,20 +249,20 @@ func (c *Cursor) RuneUnder(x int) rune {
func (c *Cursor) UpN(amount int) {
proposedY := c.Y - amount
if proposedY < 0 {
proposedY = 0
c.X = 0 // first line: X moved before the first character
return
} else if proposedY >= c.buf.NumLines {
proposedY = c.buf.NumLines - 1
}
if proposedY == c.Y {
return
runes := []rune(c.buf.Line(c.Y))
c.X = c.GetCharPosInLine(proposedY, c.LastVisualX)
if c.X > len(runes) || proposedY == c.Y {
c.X = len(runes)
}
c.Y = proposedY
runes := []rune(c.buf.Line(c.Y))
c.X = c.GetCharPosInLine(c.Y, c.LastVisualX)
if c.X > len(runes) {
c.X = len(runes)
}
}
// DownN moves the cursor down N lines (if possible)

File diff suppressed because one or more lines are too long