aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-05-03 17:21:46 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-05-03 17:31:52 +0200
commit02c18c23d7eb8e520e8584af183ca9b67937d45d (patch)
tree9a3caaa42dcb1d79074bd30476a8fc0d1f6207f7 /main.c
parent3a1b14314b9b7c00aa78eee0b2aa5b492f2dd40f (diff)
downloadvis-02c18c23d7eb8e520e8584af183ca9b67937d45d.tar.gz
vis-02c18c23d7eb8e520e8584af183ca9b67937d45d.tar.xz
vis: introduce count iterator to handle interrupted flag
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
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)