From ee518dc59a5adcc47fa5e56b39da8d347276d1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 7 Aug 2016 22:10:33 +0200 Subject: view: fix screen line based motions when cursor is not visible If a cursor is not currently visible it has no associated screen line. Fallback to the corresponding logical line based variant. For example `gj` is interpreted as `j`. Fixes #354 --- view.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'view.c') diff --git a/view.c b/view.c index 33e73cd..2d4730d 100644 --- a/view.c +++ b/view.c @@ -772,6 +772,8 @@ size_t view_line_down(Cursor *cursor) { } size_t view_screenline_up(Cursor *cursor) { + if (!cursor->line) + return view_line_up(cursor); int lastcol = cursor->lastcol; if (!lastcol) lastcol = cursor->col; @@ -784,6 +786,8 @@ size_t view_screenline_up(Cursor *cursor) { } size_t view_screenline_down(Cursor *cursor) { + if (!cursor->line) + return view_line_down(cursor); int lastcol = cursor->lastcol; if (!lastcol) lastcol = cursor->col; -- cgit v1.2.3