On Sun, May 17, 2015 at 1:01 PM, Marc André Tanner <m...@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
>> @@ -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;
>> @@ -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;

Reply via email to