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.bugs Subject: bug#28936: nRe: bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV Date: Sun, 22 Oct 2017 12:22:26 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1508700202 32036 195.159.176.226 (22 Oct 2017 19:23:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Oct 2017 19:23:22 +0000 (UTC) Cc: 28936@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 22 21:23:15 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1e6Lpx-00064k-3P for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Oct 2017 21:23:05 +0200 Original-Received: from localhost ([::1]:34043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6Lq4-0002dU-Er for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Oct 2017 15:23:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6Lpz-0002dN-9X for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2017 15:23:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6Lpu-0008CR-AI for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2017 15:23:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47549) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e6Lpu-0008CL-5z for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2017 15:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e6Lpt-0002hy-Vt for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2017 15:23:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Oct 2017 19:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28936 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28936-submit@debbugs.gnu.org id=B28936.150870015110354 (code B ref 28936); Sun, 22 Oct 2017 19:23:01 +0000 Original-Received: (at 28936) by debbugs.gnu.org; 22 Oct 2017 19:22:31 +0000 Original-Received: from localhost ([127.0.0.1]:56230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6LpP-0002gv-8I for submit@debbugs.gnu.org; Sun, 22 Oct 2017 15:22:31 -0400 Original-Received: from gateway24.websitewelcome.com ([192.185.51.61]:22297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6LpO-0002gm-3Z for 28936@debbugs.gnu.org; Sun, 22 Oct 2017 15:22:30 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway24.websitewelcome.com (Postfix) with ESMTP id B5B61C3CE for <28936@debbugs.gnu.org>; Sun, 22 Oct 2017 14:22:28 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id 6LpMeEIWPHEIm6LpMeM5HX; Sun, 22 Oct 2017 14:22:28 -0500 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=uPpwDKh9uTcwAFEfO1yfE2VpsIGJZYG/Kzc44T0wpVI=; b=R+7Tfj3TQQHL1Qofptrasqfhou E4t65kpwV0u/9+jO8I0vEywCIhX/nw4K+X3j2buBF26ajZq/XhQ/ECm1Mj64wPmR7yle5NL5UVWMS dl3rnogxkSl+62GbbRm5dqEa2YhquIVPPHUR4tsn47mEGMip38QCrNpDbwxVjYz5Yq9wfPP5Oqlrg NEiw+lwtGbssG7PcSVC+FrCDNJzKChDUR+e90Q1yInAi40SN8Y9m0LbkgQLChhekdT3Su6ipMbiCq HGtG/uT8U+pcDQy408QlJ7xEL/wtlrhjOx0Xe/ILXI1IGUcGMrupsDTmSqfKS1pRdhlk3DdO2Gf2T IdUy1IiQ==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50613 helo=server.private) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1e6LpM-003Awp-0K; Sun, 22 Oct 2017 14:22:28 -0500 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 - debbugs.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-Exim-ID: 1e6LpM-003Awp-0K 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]:50613 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:138866 Archived-At: The issue is observable at a distance of approximately up to five (5) text characters prior to ZV, rather than a distance of just one (1) it->pixel_width. And, the issue is only present when word-wrap is non-nil. In the example of a buffer containing only "Hello world!", the wrong result is observable on the letter "w", and on the letter "o", and on the letter "r" and on the letter "l", and on the letter "d", and on the exclamation point. If my recollection is collect when trying out the example, the wrong result was also observable on the space between "hello" and "world". The code that I borrowed is from xdisp.c at approximately 22680: "while (it.current_x + it.pixel_width <= target_x". I am running out the door for a few hours, and can try changing the while loop condition when I return -- however, I am fairly confident that copying the code at 22680 for this particular use case is what is needed. Thanks, Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATE: [10-22-2017 11:30:45] <22 Oct 2017 21:30:45 +0300> FROM: Eli Zaretskii > > * * * > > > With respect to `move_it_in_display_line`, I was not able to reliably land on `it.first_visible_x + lnum_pixel_width` when horizontal scrolling to the right AND text truncated on the left. IT overshoots the target by one text character. > > This means you have an off-by-one error, probably because you are > not computing the target X coordinate correctly. The mistake I show > below is probably the same mistake you do elsewhere. > > > while (it->current_x + it->pixel_width <= target_x > > This condition will cause the iterator to attempt to get to the > character _after_ point, where it will hit ZV. So what you see, viz.: > > > STEP #5: Observe that the result is "1" when it should be "2". > > is expected. You should change the condition to this: > > while (it->current_x < target_x