From b134abd515969c123182d5f20008a5f89bd7bfe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 27 Jul 2015 21:59:30 +0200 Subject: vis: ESC in normal mode clears all cursors --- view.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'view.c') diff --git a/view.c b/view.c index 43915ce..4af93f8 100644 --- a/view.c +++ b/view.c @@ -890,6 +890,13 @@ Cursor *view_cursors_new(View *view) { return c; } +int view_cursors_count(View *view) { + int i = 0; + for (Cursor *c = view_cursors(view); c; c = view_cursors_next(c)) + i++; + return i; +} + void view_cursors_free(Cursor *c) { if (!c) return; @@ -1051,9 +1058,10 @@ void view_selections_clear(View *view) { void view_cursors_clear(View *view) { for (Cursor *c = view->cursors, *next; c; c = next) { next = c->next; - view_selections_free(c->sel); - if (c != view->cursor) + if (c != view->cursor) { + view_selections_free(c->sel); view_cursors_free(c); + } } view_draw(view); } -- cgit v1.2.3