Subject: Re: bug#19200: Point adjustemnt moves *into* invisible text

From: Stefan Monnier <[email-masked]>
Date: Mon, 21 Mar 2016 11:36:23 -0400

>> The way point-adjustment is defined is too conservative for that.
>> So I suggest you try and make you code more robust w.r.t the position of
>> point within an invisible region in any case.
> Well, we just want that cursor movement starting from a visible position
> not end up at an invisible position - the docs seem to suggest that this
> should not happen, right?

It doesn't guarantee it in all cases, no.  E.g. it won't work if the
command that moves point started/ended in another buffer, or if the
command set disable-point-adjustment, plus a few other cases.

> We have the following, very simple situation:

> Line N
> { M invisible lines here }
> Line N+M+1

> Line N and Line N+M+1 are completely visible, and displayed after each
> other.  Point is at the start of Line N, no invisible text near that
> position.  Now I hit [down] one time and end up somewhere inside the
> invisible text in between.

I agree it's a bug.  I'm just pointing out that even if we fix this bug,
there will be other cases which ae not considered bugs where point will
end up in the middle of the invisible text, and where it would be odd
for your code to then operate on the selection at the "current line"
since that's not the line that the user is actually seeing.

So, yes, point-adjustment needs to be fixed (this is bug#19200), but
Magit also needs to be fixed anyway (and after that fix, it won't care
about bug#19200 nearly as much, I think).

        Stefan