aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-07-27 21:59:30 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-07-28 13:21:50 +0200
commitb134abd515969c123182d5f20008a5f89bd7bfe4 (patch)
tree9a93e77009633b76cd105917be315decb0e75ae9 /view.c
parent620518966fb99511c506af292cc1885f7a419881 (diff)
downloadvis-b134abd515969c123182d5f20008a5f89bd7bfe4.tar.gz
vis-b134abd515969c123182d5f20008a5f89bd7bfe4.tar.xz
vis: ESC in normal mode clears all cursors
Diffstat (limited to 'view.c')
-rw-r--r--view.c12
1 files changed, 10 insertions, 2 deletions
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);
}