On Wed, May 6, 2015 at 8:35 PM, Marc André Tanner <m...@brain-dump.org> wrote: > When an incomplete range is specified i.e. only a start position > the cursor should jump to it. This patch breaks this functionality. > For example :nn (absolute line), :+n (relative line), :'m mark > (move to mark) is broken.
Ah, I was not aware of that, sorry. > You probably want something ugly like the following? > > On Tue, May 05, 2015 at 06:23:53PM +0200, Silvan Jegen wrote: >> Signed-off-by: Silvan Jegen <s.je...@gmail.com> >> --- >> vis.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/vis.c b/vis.c >> index 051f256..cf157f7 100644 >> --- a/vis.c >> +++ b/vis.c >> @@ -1714,8 +1714,10 @@ static Filerange parse_range(char **cmd) { >> break; >> default: > char start = **cmd; > r.start = parse_pos(cmd); > if (**cmd != ',') { > if (start == '.') > r.end = text_line_end(txt, r.start); > return r; > } > > Also should '.' include the new line character? It seems like it does > in vim. Then text_line_next should be used. I think the behavior should mirror Vim in this case. > At the moment if no range is specified the range is set to the whole > file in exec_cmdline_command. This should probably be changed such > that the commands are called with an empty range. Then each command > can decide what its default should be. For example :write should This sounds like a good idea. > default to the whole file while :s/foo/bar/ should only be applied > to the current line by default. I noticed that vis behaves differently to Vim when no range is given. Considering that I think the use case of wanting to change the whole file is more common than just wanting to change only one line, I prefer vis' current behavior. Do you want to change it anyways? Cheers, Silvan