From 3b5fe3e0c5756107fc44cfc400766e14d8d53574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 15 Jan 2017 18:31:04 +0100 Subject: view: fix check to prevent duplicate cursor creation Previously repeatedly pressing at the start of the file would keep creating cursors. --- view.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'view.c') diff --git a/view.c b/view.c index 8b7238e..1d0e062 100644 --- a/view.c +++ b/view.c @@ -940,7 +940,10 @@ static Cursor *cursors_new(View *view, size_t pos, bool force) { Cursor *prev = NULL, *next = NULL; size_t cur = view_cursors_pos(view->cursor); - if (pos >= cur) { + if (pos == cur) { + prev = view->cursor; + next = prev->next; + } else if (pos > cur) { prev = view->cursor; for (next = prev->next; next; prev = next, next = next->next) { cur = view_cursors_pos(next); -- cgit v1.2.3