From 02c18c23d7eb8e520e8584af183ca9b67937d45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 3 May 2017 17:21:46 +0200 Subject: vis: introduce count iterator to handle interrupted flag --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index b59dea3..63d796b 100644 --- a/main.c +++ b/main.c @@ -1241,7 +1241,8 @@ static const char *repeat(Vis *vis, const char *keys, const Arg *arg) { static const char *cursors_new(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); - for (int count = vis_count_get_default(vis, 1); count > 0; count--) { + VisCountIterator it = vis_count_iterator_get(vis, 1); + while (vis_count_iterator_next(&it)) { Cursor *cursor = NULL; switch (arg->i) { case -1: @@ -1481,7 +1482,8 @@ static const char *cursors_navigate(Vis *vis, const char *keys, const Arg *arg) return keys; } Cursor *c = view_cursors_primary_get(view); - for (int count = vis_count_get_default(vis, 1); count > 0; count--) { + VisCountIterator it = vis_count_iterator_get(vis, 1); + while (vis_count_iterator_next(&it)) { if (arg->i > 0) { c = view_cursors_next(c); if (!c) -- cgit v1.2.3