From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Welsh Duggan Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87y5owjcto.fsf@gmail.com> <83pqa8vsxw.fsf@gnu.org> <87fwb1dagj.fsf_-_@gmail.com> <83wr4do1qv.fsf@gnu.org> <87bolor98t.fsf@gmail.com> <83sjf0nolt.fsf@gnu.org> <87pqa3csuc.fsf@gmail.com> <83likqojxl.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1337277483 7333 80.91.229.3 (17 May 2012 17:58:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 May 2012 17:58:03 +0000 (UTC) Cc: Ari Roponen , 11464@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 17 19:57:58 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SV4xW-0004j9-OJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 May 2012 19:57:54 +0200 Original-Received: from localhost ([::1]:44764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV4xW-0006iX-8h for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 May 2012 13:57:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV4xT-0006iQ-KH for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 13:57:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SV4xO-0007T5-O9 for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 13:57:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV4xO-0007T1-Hh for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 13:57:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SV4xe-0005K7-Af for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 13:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Welsh Duggan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 May 2012 17:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11464-submit@debbugs.gnu.org id=B11464.133727744020409 (code B ref 11464); Thu, 17 May 2012 17:58:02 +0000 Original-Received: (at 11464) by debbugs.gnu.org; 17 May 2012 17:57:20 +0000 Original-Received: from localhost ([127.0.0.1]:59588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SV4wx-0005J8-SI for submit@debbugs.gnu.org; Thu, 17 May 2012 13:57:20 -0400 Original-Received: from euclid.red.cert.org ([192.88.209.48]:33234) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SV4wv-0005Iw-W6 for 11464@debbugs.gnu.org; Thu, 17 May 2012 13:57:18 -0400 Original-Received: from bucknell.indigo.cert.org (bucknell.indigo.cert.org [10.60.10.121]) by euclid.red.cert.org (8.14.4/8.14.4) with ESMTP id q4HHpecJ003422; Thu, 17 May 2012 13:51:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cert.org; s=jthatj15xw2j; t=1337277100; bh=X9VyzWdcq6G6hmLC/rZmkd8IQ0H+KOqkg6DF2GMrpSU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type:Sender:Reply-To; b=Rn9dgW1/C6N7iG8VBUFIAXRXx5wBF+DjfKP4QL0RAla+JrKmkpcNV9UBhRXVRIYQ3 m0+O+Kf9Ai4djybzAb5utN8jWHHR3DjStZ+vCCAdgLgjv4OpSbwGk74oAaJ5F9hNgc vqkXrTsVcHQZnZnLjzuiEHGhoXuT9kXlTKNWeAYU= Original-Received: from waterbuck.yellow.cert.org (waterbuck.yellow.cert.org [10.20.128.84]) by bucknell.indigo.cert.org (8.14.4/8.14.4/2.81) with ESMTP id q4HHupjA021402; Thu, 17 May 2012 13:56:51 -0400 Original-Received: (from mwd@localhost) by waterbuck.yellow.cert.org (8.14.4/8.14.4/Submit/1.6) id q4HHuj1a008685; Thu, 17 May 2012 13:56:45 -0400 X-Authentication-Warning: waterbuck.yellow.cert.org: mwd set sender to mwd@cert.org using -f In-Reply-To: <83likqojxl.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 May 2012 19:23:50 +0300") User-Agent: Gnus/5.11002 (No Gnus v0.20) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60144 Archived-At: Eli Zaretskii writes: >> From: Ari Roponen >> 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)