diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-03-28 12:40:35 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-03 13:22:14 +0200 |
| commit | 9b9bb9130998e16ef75f4119cd02e52ed639c4ce (patch) | |
| tree | 9709d5099777171a9d94aa73892cbe76ffe8e82a /sam.c | |
| parent | 8bb3dd7817c0e3b7d9c621ea86925a08a90cf1d1 (diff) | |
| download | vis-9b9bb9130998e16ef75f4119cd02e52ed639c4ce.tar.gz vis-9b9bb9130998e16ef75f4119cd02e52ed639c4ce.tar.xz | |
sam: adapt to changes in multiple cursors API
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -728,7 +728,7 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, Filerange *range) { bool ret = true; View *view = win->view; Text *txt = win->file->text; - bool multiple_cursors = view_cursors_count(view) > 1; + bool multiple_cursors = view_cursors_multiple(view); for (Cursor *c = view_cursors(view), *next; c; c = next) { next = view_cursors_next(c); Filerange sel; @@ -754,15 +754,12 @@ static bool cmd_print(Vis *vis, Win *win, Command *cmd, Filerange *range) { return false; View *view = win->view; Text *txt = win->file->text; - Cursor *cursor = view_cursors_new(view); - if (cursor) { - if (range->start != range->end) { - view_cursors_selection_set(cursor, range); - view_cursors_to(cursor, text_char_prev(txt, range->end)); - } else { - view_cursors_to(cursor, range->end); - } - } + size_t pos = range->end; + if (range->start != range->end) + pos = text_char_prev(txt, pos); + Cursor *cursor = view_cursors_new(view, pos); + if (cursor && range->start != range->end) + view_cursors_selection_set(cursor, range); return cursor != NULL; } |
