From 138bc80f5bec0f192cdba189b6ad8920050eb5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 23 Feb 2017 20:45:25 +0100 Subject: 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. --- view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view.c') diff --git a/view.c b/view.c index d681656..db9a8a6 100644 --- 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; } -- cgit v1.2.3