diff --git a/internal/buffer/cursor.go b/internal/buffer/cursor.go index 2d4d2da2..dc5c7313 100644 --- a/internal/buffer/cursor.go +++ b/internal/buffer/cursor.go @@ -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