[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive wit
From: |
Michael Welsh Duggan |
Subject: |
bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text |
Date: |
Thu, 17 May 2012 13:56:45 -0400 |
User-agent: |
Gnus/5.11002 (No Gnus v0.20) Emacs/24.1.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Ari Roponen <ari.roponen@gmail.com>
>> Cc: 11464@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.
Maybe I am misunderstanding, but I think possibly you've been staring at
the code too long.
if (top_y < window_top_y) ==> if (255 < 0) ==> if (FALSE)
else if (top_y < it.last_visible_y) ==> if (255 < 256) ==> if (TRUE)
hence, visible_p _would_ be set to 1 by the else if clause.
--
Michael Welsh Duggan
(mwd@cert.org)
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/13
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/13
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/15
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/15
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/16
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/16
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/17
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/17
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/17
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text,
Michael Welsh Duggan <=
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/17
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Michael Welsh Duggan, 2012/05/17
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Ari Roponen, 2012/05/18
- bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text, Eli Zaretskii, 2012/05/18