vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 412f9c60c47624bed2127da7f40ffa80156716ec
parent 76261a453c4525950b748bd4b26be285e920fe34
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 15 May 2017 13:12:49 +0200

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:
Msam.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 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; }