Re: [dev] [vis][PATCH] Make the '.' Filerange work on one line

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Wed, 6 May 2015 20:35:07 +0200

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.

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.jegen_AT_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
> _AT_@ -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.

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
default to the whole file while :s/foo/bar/ should only be applied
to the current line by default.

Thanks,
Marc

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
Received on Wed May 06 2015 - 20:35:07 CEST

This archive was generated by hypermail 2.3.0 : Wed May 06 2015 - 20:36:08 CEST