GNU bug report logs - #11464
24.1.50; pos-visible-in-window-p returns a false positive with bidi text

Previous Next

Package: emacs;

Reported by: Ari Roponen <ari.roponen <at> gmail.com>

Date: Sun, 13 May 2012 15:56:01 UTC

Severity: normal

Found in version 24.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ari Roponen <ari.roponen <at> gmail.com>
Cc: 11464 <at> debbugs.gnu.org
Subject: bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text
Date: Thu, 17 May 2012 19:23:50 +0300
> From: Ari Roponen <ari.roponen <at> gmail.com>
> Cc: 11464 <at> debbugs.gnu.org
> Date: Thu, 17 May 2012 07:52:11 +0300
> 
> bottom_y = 270
> it.last_visible_y = 256
> top_y = 255
> window_top_y = 0

Now I'm totally bewildered.  I don't understand how this case is at
all relevant to the bug.  Please bear with me while I explain what
puzzles me, and please point out what I missed.

Here's the relevant code fragment:

      int top_x = it.current_x;
      int top_y = it.current_y;
      /* Calling line_bottom_y may change it.method, it.position, etc.  */
      enum it_method it_method = it.method;
      int bottom_y = (last_height = 0, line_bottom_y (&it));
      int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);

      if (top_y < window_top_y)
	visible_p = bottom_y > window_top_y;
      else if (top_y < it.last_visible_y)
	visible_p = 1;
      if (bottom_y <= it.last_visible_y
	  && it.bidi_p && it.bidi_it.scan_dir == -1
	  && IT_CHARPOS (it) < charpos)
	{

The original problem was that the "else if" clause would incorrectly
set visible_p to 1.  The "if" clause I added after that, viz.:

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

attempts to correct that, by eventually resetting visible_p to zero.

Now, if bottom_y = 270, it.last_visible_y = 256, and top_y = 255, then
the condition in the above "else if" clause is false, and visible_p
could not possibly be set to 1.  The preceding "if" clause is also
false, since window_top_y = 0.  Therefore, visible_p should have
stayed zero for this situation, and I don't understand why you needed
to change

      if (bottom_y >= it.last_visible_y

into

      if (bottom_y <= it.last_visible_y

Can you tell where I'm wrong?

Thanks in advance.




This bug report was last modified 13 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.