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

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Mon, 18 May 2015 11:18:15 +0200

On Sun, May 17, 2015 at 1:01 PM, Marc André Tanner <mat_AT_brain-dump.org> wrote:
> On Fri, May 15, 2015 at 10:16:49AM +0200, Silvan Jegen wrote:
>> ---
>>
>> The first version broke some functionality. This one doesn't by doing
>> some more ugly checking.
>>
>> We also make sure that we include the newline by using text_line_next
>> instead of text_line_finish.
>>
>> vis.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/vis.c b/vis.c
>> index 051f256..a714bf0 100644
>> --- a/vis.c
>> +++ b/vis.c
>> _AT_@ -1701,6 +1701,7 @@ static Filerange parse_range(char **cmd) {
>> Text *txt = vis->win->file->text;
>> Filerange r = text_range_empty();
>> Mark *marks = vis->win->file->marks;
>> + char orig = **cmd;
>> switch (**cmd) {
>> case '%':
>> r.start = 0;
>> _AT_@ -1714,8 +1715,11 @@ static Filerange parse_range(char **cmd) {
>> break;
>> default:
>> r.start = parse_pos(cmd);
>> - if (**cmd != ',')
>> + if (orig != ',') {
>
> This part is wrong. I commited a (hopefully) fixed version.

Yes, because parse_pos increases the *cmd pointer. Thanks for fixing it!

I think this would work too but I am not sure whether that's better or not.

        default:
                r.start = parse_pos(cmd);
- if (**cmd != ',') {
- if (start == '.')
- r.end = text_line_next(txt, r.start);
- return r;
- }
+ if (start == '.')
+ r.end = text_line_next(txt, r.start);
+ if (**cmd != ',')
+ return r;
Received on Mon May 18 2015 - 11:18:15 CEST

This archive was generated by hypermail 2.3.0 : Mon May 18 2015 - 11:24:07 CEST