aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-03-10 22:18:09 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-03-10 22:36:54 +0100
commit054f792ac6c1502d5f9bb2b251b3f96c4cb27f6b (patch)
tree161d42f53cf794840c795ad5d2d1b900c51f99b9 /main.c
parent0e322d577bf834d8f7c9a7d3c53a58f8e7bb93c1 (diff)
downloadvis-054f792ac6c1502d5f9bb2b251b3f96c4cb27f6b.tar.gz
vis-054f792ac6c1502d5f9bb2b251b3f96c4cb27f6b.tar.xz
view: add query function for multiple cursors
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.c b/main.c
index bb6f8cf..11d55e4 100644
--- a/main.c
+++ b/main.c
@@ -1253,7 +1253,7 @@ static const char *cursors_align_indent(Vis *vis, const char *keys, const Arg *a
static const char *cursors_clear(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
- if (view_cursors_count(view) > 1)
+ if (view_cursors_multiple(view))
view_cursors_clear(view);
else
view_cursors_selection_clear(view_cursors_primary_get(view));
@@ -1317,8 +1317,7 @@ static const char *cursors_remove(Vis *vis, const char *keys, const Arg *arg) {
static const char *cursors_navigate(Vis *vis, const char *keys, const Arg *arg) {
View *view = vis_view(vis);
- bool multiple_cursors = view_cursors_next(view_cursors(view));
- if (!multiple_cursors)
+ if (!view_cursors_multiple(view))
return wscroll(vis, keys, arg);
Cursor *c = view_cursors_primary_get(view);
if (arg->i < 0) {
@@ -1471,7 +1470,7 @@ static const char *undo(Vis *vis, const char *keys, const Arg *arg) {
size_t pos = text_undo(vis_text(vis));
if (pos != EPOS) {
View *view = vis_view(vis);
- if (view_cursors_count(view) == 1)
+ if (!view_cursors_multiple(view))
view_cursor_to(view, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);
@@ -1483,7 +1482,7 @@ static const char *redo(Vis *vis, const char *keys, const Arg *arg) {
size_t pos = text_redo(vis_text(vis));
if (pos != EPOS) {
View *view = vis_view(vis);
- if (view_cursors_count(view) == 1)
+ if (!view_cursors_multiple(view))
view_cursor_to(view, pos);
/* redraw all windows in case some display the same file */
vis_draw(vis);