]> git.lizzy.rs Git - micro.git/commitdiff
Up arrow on first line brings to start
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 3 Jun 2020 04:27:24 +0000 (00:27 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 3 Jun 2020 04:27:24 +0000 (00:27 -0400)
Fixes #1701

internal/buffer/cursor.go

index 2d4d2da2c121eff564afe1b5d9a98d35807541fa..dc5c73138c08f8e3d1a4af63f14b1b533f4261ff 100644 (file)
@@ -242,6 +242,12 @@ func (c *Cursor) UpN(amount int) {
 
        if c.X > util.CharacterCount(bytes) || (amount < 0 && proposedY == c.Y) {
                c.X = util.CharacterCount(bytes)
+               c.StoreVisualX()
+       }
+
+       if c.X < 0 || (amount > 0 && proposedY == c.Y) {
+               c.X = 0
+               c.StoreVisualX()
        }
 
        c.Y = proposedY