Subject: Re: bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text

From: Eli Zaretskii <[email-masked]>
Date: Fri, 18 May 2012 11:44:34 +0300

> From: Ari Roponen <[email-masked]>
> Cc: Michael Welsh Duggan <[email-masked]>,  [email-masked]
> Date: Fri, 18 May 2012 11:03:52 +0300
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >
> > It's 270, yes.  But the rest is correct: if visible_p is set  in this
> > case, it will never be reset with the current code.  My original code
> > used
> >
> >       if (bottom_y >= it.last_visible_y
> >
> > which would have caught this case.
> >
> > Ari, can you please describe again what happens in this particular
> > case on your machine, step by step, when you step with a debugger
> > through the relevant fragment?
> 
> I sent this reply tonight:
> http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00476.html
> 
> The summary is that the case you are wondering about didn't have the bug
> at all.

Yes, you did say that.  But as Michael points out, this fragment

      else if (top_y < it.last_visible_y)
	visible_p = 1;

should have set visible_p to 1 in your last case, the one where

> bottom_y = 270
> it.last_visible_y = 256
> top_y = 255
> window_top_y = 0

And if that happens, the correction code below, viz.:

      if (bottom_y <= it.last_visible_y
	  && it.bidi_p && it.bidi_it.scan_dir == -1
	  && IT_CHARPOS (it) < charpos)

would evaluate to false, and visible_p would have stayed at its 1
value, which is wrong.

So could you please clarify this case?

Also, what was the value of top_y in your first case, i.e.:

> bottom_y = 300
> it.last_visible_y = 304

Again, sorry for bothering you with the details.  I just must
understand what is going on here and where did I err in my original
change.

Thanks!