this seems like a bug to me - it doesn't follow the description
in the manual page. the end of the empty selection at the
start of a line is surely within that line.

i had a look at the code, and was surprised by the fact that
the logic appears to implemented in two places;
middle clicking "Edit +" executes lineaddr() where
right clicking ":+" goes through number().

in both cases, the code checks whether the character 1 before
the end of the selection is '\n' which only works if the selection
is non-null.

a simple fix in lineaddr might look like this:

                        if(sign==0 || addr.r.q1==0){
                                p = 0;
                                n = 1;
                        }else if(addr.r.q1 > addr.r.q0){
                                p = addr.r.q1-1;
                                n = textreadc(f->curtext, p++)=='\n';
                        }else{
                                p = addr.r.q0;
                                n = 0;
                        }

this issue is made more awkward by the fact that the selection
at the start of a line is included when the line before it is
entirely selected - in some sense it's actually in both lines.

i think it's worth adding a special case for the null selection,
but others' mileages may vary.


On 19 April 2010 13:59, Rudolf Sykora <rudolf.syk...@gmail.com> wrote:
>> the idiom is -+  try + then - one-at-a-time and you'll see why.
>>
>> - erik
>>
>
> Well, ok, -+ works in any case, so it's actually what I usually need.
> Still I don't fully understand.
> The man page says:
>
> Some useful idioms: a1+- (a1-+) selects
> the line containing the end (beginning) of a1.
>
> Isn't it that an empty dot has the same beginning and end?
> Isn't it that my dot (here place 'just before the beginning 'I' of
> this sentence) is on the same line as the 'I' itself?
> Moreover, even if the beginning and end wouldn't be identical for my
> case, I'd still expect that the beginning is before the end... (so
> that +- would have a better chance to match my line!).
>
> Thanks
> Ruda
>
>

Reply via email to