vis

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

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

commit e4ea6f72191eaf19c62a8faa9d8af2824378094e
parent 76ee00ee04a33cc3f755e81d39289498626938cb
Author: Randy Palamar <palamar@ualberta.ca>
Date:   Mon, 23 Oct 2023 17:54:53 -0600

sam: reject invalid ranges for cmd_extract ("x"/"y")

fixes #1152: `:2x/foo/<cr>` in a file with only one line makes vis
get stuck in an infinite loop

Diffstat:
Msam.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sam.c b/sam.c @@ -1497,7 +1497,7 @@ static int extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selecti } static bool cmd_extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selection *sel, Filerange *range) { - if (!win) + if (!win || !text_range_valid(range)) return false; int matches = 0; if (count_negative(cmd->cmd))