aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-05 10:29:39 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-05 10:29:39 +0200
commitf0b64700f9da35bfb013574b597f11a1ad3d2a65 (patch)
tree940dfcfc203191e23a566f79f77c2872397d47d9
parent57565561390ca1856aab89dc204cfe6d9a2b1223 (diff)
downloadvis-f0b64700f9da35bfb013574b597f11a1ad3d2a65.tar.gz
vis-f0b64700f9da35bfb013574b597f11a1ad3d2a65.tar.xz
sam: stop executing once a command fails
-rw-r--r--sam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sam.c b/sam.c
index ca92654..5f915bc 100644
--- a/sam.c
+++ b/sam.c
@@ -725,7 +725,7 @@ static bool sam_execute(Vis *vis, Win *win, Command *cmd, Cursor *cur, Filerange
Mark start, end;
Filerange group = *range;
- for (Command *c = cmd->cmd; c; c = c->next) {
+ for (Command *c = cmd->cmd; c && ret; c = c->next) {
if (!text_range_valid(&group))
return false;
@@ -912,7 +912,7 @@ 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);
- for (Cursor *c = view_cursors(view), *next; c; c = next) {
+ for (Cursor *c = view_cursors(view), *next; c && ret; c = next) {
next = view_cursors_next(c);
Filerange sel;
size_t pos = view_cursors_pos(c);