From f0b64700f9da35bfb013574b597f11a1ad3d2a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 5 Apr 2016 10:29:39 +0200 Subject: sam: stop executing once a command fails --- sam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sam.c') 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); -- cgit v1.2.3