From 9b9bb9130998e16ef75f4119cd02e52ed639c4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 28 Mar 2016 12:40:35 +0200 Subject: sam: adapt to changes in multiple cursors API --- sam.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sam.c b/sam.c index b050cfc..baaa365 100644 --- a/sam.c +++ b/sam.c @@ -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; } -- cgit v1.2.3