vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit c58613d7b3a9bd1b426c1bff92aada988ab3c7cf
parent a2e7a5af431408e9ab9fefa40d0e0151b8fc9977
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 23 Feb 2017 20:45:25 +0100

view: make sure viewport remains valid when scrolling up

In a file with windows style \r\n line endings scrolling
up would wrap around to the end of the file.

Diffstat:
Mview.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/view.c b/view.c @@ -664,7 +664,7 @@ bool view_viewport_up(View *view, int n) { } while (text_iterator_byte_prev(&it, &c)); if (c == '\r') off++; - view->start -= off; + view->start -= MIN(view->start, off); view_draw(view); return true; }