aboutsummaryrefslogtreecommitdiff
path: root/sam.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-05-15 13:12:49 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-05-15 13:12:49 +0200
commit4351318472c846cabaa42433f32ea44d6a41c8d6 (patch)
tree7a06606a2791e9fe38eed74f5738e60c9034d280 /sam.c
parent9d216fdaca5c89fdce1308cc1b2b2ed2f7fdee11 (diff)
downloadvis-4351318472c846cabaa42433f32ea44d6a41c8d6.tar.gz
vis-4351318472c846cabaa42433f32ea44d6a41c8d6.tar.xz
sam: use default address for file looping commands
This sould fix a clang analyzer warning and make the code more robust. The problem could actually not occur in practice because the X and Y commands always have the internal cmd_select as intermediate node in the execution tree. In general the multiple file support will need more design work. Fix #551
Diffstat (limited to 'sam.c')
-rw-r--r--sam.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sam.c b/sam.c
index c25bf4f..19894bf 100644
--- a/sam.c
+++ b/sam.c
@@ -1519,8 +1519,10 @@ static bool cmd_files(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
continue;
bool match = !cmd->regex || (win->file->name &&
text_regex_match(cmd->regex, win->file->name, 0));
- if (match ^ (argv[0][0] == 'Y'))
- ret &= sam_execute(vis, win, cmd->cmd, NULL, NULL);
+ if (match ^ (argv[0][0] == 'Y')) {
+ Filerange def = text_range_new(0, 0);
+ ret &= sam_execute(vis, win, cmd->cmd, NULL, &def);
+ }
}
return ret;
}