From 8cf56bfc56b967bcc5cc3741df0937326ac6782b Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 3 Jun 2020 00:27:24 -0400 Subject: [PATCH] Up arrow on first line brings to start Fixes #1701 --- internal/buffer/cursor.go | 6 ++++++ 1 file changed, 6 insertions(+) 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