mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 13:57:07 +09:00
Merge pull request #1166 from rexy712/master
Fix UpN to handle going from long line to short line
This commit is contained in:
@@ -255,7 +255,6 @@ func (c *Cursor) RuneUnder(x int) rune {
|
||||
}
|
||||
return line[x]
|
||||
}
|
||||
|
||||
// UpN moves the cursor up N lines (if possible)
|
||||
func (c *Cursor) UpN(amount int) {
|
||||
proposedY := c.Y - amount
|
||||
@@ -266,9 +265,8 @@ func (c *Cursor) UpN(amount int) {
|
||||
proposedY = c.buf.NumLines - 1
|
||||
}
|
||||
|
||||
runes := []rune(c.buf.Line(c.Y))
|
||||
runes := []rune(c.buf.Line(proposedY))
|
||||
c.X = c.GetCharPosInLine(proposedY, c.LastVisualX)
|
||||
|
||||
if c.X > len(runes) || (amount < 0 && proposedY == c.Y) {
|
||||
c.X = len(runes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user