vis

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

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

commit 3230283a4909d7913dc98d9de1d37e2333134cd0
parent d5c432fa1781c1d13b33b9c4bb298bd5dd458739
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 14 May 2015 19:44:48 +0200

Let each :-command decide what to do if no range is specified

Diffstat:
Mvis.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vis.c b/vis.c @@ -1610,6 +1610,8 @@ static bool cmd_wq(Filerange *range, enum CmdOpt opt, const char *argv[]) { static bool cmd_write(Filerange *range, enum CmdOpt opt, const char *argv[]) { Text *text = vis->win->file->text; + if (!text_range_valid(range)) + range = &(Filerange){ .start = 0, .end = text_size(text) }; if (!argv[1]) argv[1] = text_filename_get(text); if (!argv[1]) { @@ -1763,7 +1765,6 @@ static bool exec_cmdline_command(const char *cmdline) { free(line); return false; } - range = (Filerange){ .start = 0, .end = text_size(vis->win->file->text) }; } /* skip leading white space */ while (*name == ' ')