From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: Problems with move_it_in_display_line_to X when tabs exist. Date: Tue, 16 Jan 2018 09:53:04 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1516125768 28484 195.159.176.226 (16 Jan 2018 18:02:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 16 Jan 2018 18:02:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 16 19:02:43 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebVZJ-0006sN-Lr for ged-emacs-devel@m.gmane.org; Tue, 16 Jan 2018 19:02:42 +0100 Original-Received: from localhost ([::1]:52390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebVbJ-0002sp-HP for ged-emacs-devel@m.gmane.org; Tue, 16 Jan 2018 13:04:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebVQJ-000274-Ko for emacs-devel@gnu.org; Tue, 16 Jan 2018 12:53:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebVQF-0004LU-OI for emacs-devel@gnu.org; Tue, 16 Jan 2018 12:53:23 -0500 Original-Received: from gateway33.websitewelcome.com ([192.185.146.97]:18852) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebVQF-0004Ee-EJ for emacs-devel@gnu.org; Tue, 16 Jan 2018 12:53:19 -0500 Original-Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 5F921204AB68 for ; Tue, 16 Jan 2018 11:53:06 -0600 (CST) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id bVQ2eQYoyBUMKbVQ2eXUlv; Tue, 16 Jan 2018 11:53:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=16Eiub1Kx5b8uKDvmeiX5JwyyUvtzlomR5ZiARnYzxw=; b=BthHQqO9pHW2Eir2L4fA8jbKnX +UUJY8kb/xIZa/rzNoIo5dfmp9+qLkLaWlWNCSS6H1phv7Dd/8bNewsyYwFy0fg6qyUTiDb4NxsZr /q3QWVzyDGGI/pp/fvQEJoI7urZ+2Z7/GKAEgILVKgBen+tMbdB8N7Ymm8tj/8tXzZ1GvspNeAQZI eitvqHD2whtEOOUYj3nhB3rO+GXLEBtlCdwTxQ4jRQMV/q4DarSRY+zQEL2z8mWIr45tdKz+xH2vR 5vA3nCZ2EBQUORn/Z5WFk67X/C2gplfwwvS0KG/RKDsNtyLQL6D6ZkiEMIBHKKIUEIUQiw70ucML9 mo/T7+Uw==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:49433 helo=server.private) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89) (envelope-from ) id 1ebVQ1-004GJl-JA; Tue, 16 Jan 2018 11:53:05 -0600 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1ebVQ1-004GJl-JA X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.private) [45.48.239.195]:49433 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.146.97 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222020 Archived-At: x_produce_glyphs runs multiple times on the line containing the STRETCH tab. The value for it->pixel_width of the STRETCH tab (in this example) is _only_ correct when it->current_x is >= it->lnum_pixel_width. Inasmuch as move_it_in_display_line_to is reporting that it.pixel_width remains at 49 even though the STRETCH shrinks (as we call scroll-left 1) to 42 to 35 to 28, it appears that x_produce_glyphs may be overwriting the correct value with the wrong value. I restricted the floodgate of STDERR messages coming from x_produce_glyphs to only the situation when x0 >= it->lnum_pixel_width. x_produce_glyphs probably runs _again_ when x0 < it->lnum_pixel_width, which overwrites the good value with the bad value. Then, when I run move_it_in_display_line_to in screenshots 02 and 03, the err oneous value of 49 is returned -- the correct value in screenshot 02 should be 35, and the correct value in screenshot 03 should be 28. If the previous value of it->pixel_width for the prior comman d loop were correct, then we would not see a consistent value of 49 in schreenshots 02 and 03 -- instead, we would see a value of 42 in screenshot 02 [which is really 35] and we would see a value 35 in screenshot 03 [which is really 28]. It may be the case that it is presently impossible to know the prospective _new_ value of it->pixel_width for a STRETCH tab (in this example) when calling move_it_in_display_line_to. Since x_produce_glyphs knows how to calculate the correct value of it->pixel_width (when x0 >= it->lnum_pixel_width), perhaps there is a way to teach move_it_in_display_line_to how to do this? Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATE: [01-16-2018 09:00:43] <16 Jan 2018 19:00:43 +0200> FROM: Eli Zaretskii > > > Date: Mon, 15 Jan 2018 20:41:52 -0800 > > From: Keith David Bershatsky > > Cc: emacs-devel@gnu.org > > > > The following screenshots with stderr results were obtained by calling the function debug-tab-pixel-width, which is contained in the attached patch.diff. I saw that x_produce_glyphs is able to achieve the correct it->pixel_width for the STRETCH tab when x0 >= it->lnum_pixel_width; however, it is run subsequent in time to when we call move_it_in_display_line_to. > > > > > > 0. Opening screenshot -- just setting up the test buffer. > > > > https://www.lawlist.com/images/tab_width_bug_00.png > > > > > > 1. Place the cursor on the line that begins with a tab, and press the f5 key once. > > > > https://www.lawlist.com/images/tab_width_bug_01.png > > > > OBSERVATIONS (w->hscroll == 1): The expected result is that the STRETCH tab will have an it.pixel_width of 42. The third (3rd) iteration/loop has the wrong value; i.e., 49. The fourth (4th) iteration/loop has the correct value; i.e., 42. x_produce_glyphs runs subsequent in time and contains the desired value of 42 when x0 >= it->lnum_pixel_width. > > What do you mean by "x_produce_glyphs runs subsequent in time"? The > value of it->pixel_width is updated by x_produce_glyphs, so before it > was called, that value is outdated (belongs to the previous glyph). > If that is what you observe, then it's the expected behavior, and not > a bug.