diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-04-12 21:50:56 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-04-12 21:50:56 +0200 |
| commit | c25e0c110430bd16056c6fe12e9e6676ebf1e5f5 (patch) | |
| tree | 4229703f1f653c477f2b229d34eb5d7cbba9cb03 | |
| parent | bcc479670b2a317042fbfc6acf99f81f8958745f (diff) | |
| download | vis-c25e0c110430bd16056c6fe12e9e6676ebf1e5f5.tar.gz vis-c25e0c110430bd16056c6fe12e9e6676ebf1e5f5.tar.xz | |
sam: fix negative count specifiers from visual mode
| -rw-r--r-- | sam.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1131,7 +1131,7 @@ static bool count_negative(Command *cmd) { if (cmd->count.start < 0 || cmd->count.end < 0) return true; for (Command *c = cmd->cmd; c; c = c->next) { - if (c->cmddef->func != cmd_extract) { + if (c->cmddef->func != cmd_extract && c->cmddef->func != cmd_select) { if (count_negative(c)) return true; } @@ -1147,7 +1147,7 @@ static void count_init(Command *cmd, int max) { if (count->end < 0) count->end += max; for (Command *c = cmd->cmd; c; c = c->next) { - if (c->cmddef->func != cmd_extract) + if (c->cmddef->func != cmd_extract && c->cmddef->func != cmd_select) count_init(c, max); } } @@ -1441,6 +1441,9 @@ static bool cmd_select(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur bool multiple_cursors = view_cursors_multiple(view); Cursor *primary = view_cursors_primary_get(view); + if (vis->mode->visual) + count_init(cmd->cmd, view_cursors_count(view)+1); + for (Cursor *c = view_cursors(view), *next; c && ret; c = next) { next = view_cursors_next(c); size_t pos = view_cursors_pos(c); |
