From b58c9169bb5986cd87a2f98fb8854c86638b70f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 14 May 2015 19:44:48 +0200 Subject: Let each :-command decide what to do if no range is specified --- vis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vis.c b/vis.c index 4468b62..ee30c20 100644 --- 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 == ' ') -- cgit v1.2.3