diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-04-13 17:17:14 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-13 17:17:14 +0200 |
| commit | 6c2b9033cfb1a82275871b2800c5ef1e4cf877a5 (patch) | |
| tree | e3e9eae9658389541ecff0d1d72f674557a0c3e1 | |
| parent | 0ab78db2cf8ca04c9b882f7b572819c8f34323ae (diff) | |
| download | vis-6c2b9033cfb1a82275871b2800c5ef1e4cf877a5.tar.gz vis-6c2b9033cfb1a82275871b2800c5ef1e4cf877a5.tar.xz | |
Use view_cursors_new_force where appropriate
Close #263
| -rw-r--r-- | sam.c | 16 | ||||
| -rw-r--r-- | vis-operators.c | 2 |
2 files changed, 3 insertions, 15 deletions
@@ -826,16 +826,8 @@ static bool cmd_guard(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs static bool cmd_extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) { bool ret = true; - View *view = win->view; Text *txt = win->file->text; - Cursor *cursor = NULL; - size_t pos = view_cursor_get(view); - if (cur && !view_cursors_dispose(cur)) { - cursor = view_cursors_new(view, text_size(txt)+1); - view_cursors_dispose(cur); - } - if (cmd->regex) { size_t start = range->start, end = range->end, last_start = EPOS; RegexMatch match[1]; @@ -901,11 +893,7 @@ static bool cmd_extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Cu } } - if (cursor && !view_cursors_dispose(cursor)) { - view_cursors_selection_clear(cursor); - view_cursors_to(cursor, pos); - } - + view_cursors_dispose(cur); return ret; } @@ -972,7 +960,7 @@ static bool cmd_print(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs if (cur) view_cursors_to(cur, pos); else - cur = view_cursors_new(view, pos); + cur = view_cursors_new_force(view, pos); if (cur) { if (range->start != range->end) view_cursors_selection_set(cur, range); diff --git a/vis-operators.c b/vis-operators.c index 5fb33b1..aceb3d1 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -176,7 +176,7 @@ static size_t op_cursor(Vis *vis, Text *txt, OperatorContext *c) { pos = text_line_finish(txt, line); else pos = text_line_start(txt, line); - view_cursors_new(view, pos); + view_cursors_new_force(view, pos); } return EPOS; } |
