From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.bugs Subject: bug#20701: 25.0.50; [PATCH] (vertical-motion 0) broken at display strings after newline Date: Sun, 31 May 2015 16:19:46 +0200 Message-ID: <85y4k47qf6.fsf@iznogoud.viz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1433083896 13390 80.91.229.3 (31 May 2015 14:51:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 May 2015 14:51:36 +0000 (UTC) To: 20701@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 31 16:51:15 2015 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 1Yz4a2-00017l-B0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 May 2015 16:51:14 +0200 Original-Received: from localhost ([::1]:42270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4a1-0004Tb-Pa for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 May 2015 10:51:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4Zx-0004TV-EV for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:51:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz4Zu-0003UK-7c for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:51:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4Zu-0003UE-2g; Sun, 31 May 2015 10:51:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yz4Zt-0006VG-GQ; Sun, 31 May 2015 10:51:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Jenkner Original-Sender: "Debbugs-submit" Resent-CC: eliz@gnu.org, bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 May 2015 14:51:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20701 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Eli Zaretskii Original-Received: via spool by submit@debbugs.gnu.org id=B.143308381424939 (code B ref -1); Sun, 31 May 2015 14:51:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 May 2015 14:50:14 +0000 Original-Received: from localhost ([127.0.0.1]:35014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yz4Z2-0006UA-UX for submit@debbugs.gnu.org; Sun, 31 May 2015 10:50:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45772) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yz4Z0-0006Tv-4l for submit@debbugs.gnu.org; Sun, 31 May 2015 10:50:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz4Yt-0002vn-Qt for submit@debbugs.gnu.org; Sun, 31 May 2015 10:50:04 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4Yt-0002vd-OU for submit@debbugs.gnu.org; Sun, 31 May 2015 10:50:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4Ys-0003Pi-Ji for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:50:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz4Yp-0002pD-Dp for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:50:02 -0400 Original-Received: from b2bfep12.mx.upcmail.net ([62.179.121.57]:35188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4Yp-0002os-3p for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:49:59 -0400 Original-Received: from edge11.upcmail.net ([192.168.13.81]) by b2bfep16.mx.upcmail.net (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20150531144926.QMXA23037.b2bfep16-int.chello.at@edge11.upcmail.net> for ; Sun, 31 May 2015 16:49:26 +0200 Original-Received: from iznogoud.viz ([91.119.211.5]) by edge11.upcmail.net with edge id aepZ1q00U07YXJr0Bepalv; Sun, 31 May 2015 16:49:34 +0200 X-SourceIP: 91.119.211.5 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.85 (FreeBSD)) (envelope-from ) id 1Yz4YP-0000nO-FG for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 16:49:33 +0200 User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:103397 Archived-At: If you run the following snippet in emacs -Q point will end up at the first line of the "Test" buffer, but it should stay at the second line. (with-current-buffer (generate-new-buffer "Test") (pop-to-buffer (current-buffer)) (insert "x\n") (save-excursion (insert (propertize "x" 'display "x"))) (sit-for 1) (vertical-motion 0)) On the other hand, non-zero arguments for vertical-motion seem to work correctly, as long as the buffer contains only ASCII characters before the propertized "x". Otherwise (with-current-buffer (generate-new-buffer "Test") (pop-to-buffer (current-buffer)) (insert "\n=C3=A9\n") (save-excursion (insert (propertize "x" 'display "x"))) (sit-for 1) (vertical-motion -1)) Here, point should go to the second line but it goes to the first line. The following patch tries to fix both issues. -- >8 -- Subject: [PATCH] * src/indent.c (Fvertical_motion): Fix a case of motion by= 0 lines. Starting from a display string after a newline, point went to the previous line. Also, correct an inadvertent use of a buffer position with FETCH_BYTE. --- src/indent.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/indent.c b/src/indent.c index ce78308..b4e6d74 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2134,17 +2134,20 @@ whether or not it is currently displayed in some wi= ndow. */) overshoot_handled =3D 1; } else if (IT_CHARPOS (it) =3D=3D PT - 1 - && FETCH_BYTE (PT - 1) =3D=3D '\n' - && nlines < 0) + && FETCH_BYTE (PT_BYTE - 1) =3D=3D '\n' + && nlines <=3D 0) { /* The position we started from was covered by a display property, so we moved to position before the string, and - backed up one line, because the character at PT - 1 is a - newline. So we need one less line to go up. */ + backed up one line, because the character at PT - 1 is + a newline. So we need one less line to go up (or exactly + one line to go down if nlines =3D=3D 0). */ nlines++; /* But we still need to record that one line, in order to return the correct value to the caller. */ vpos_init =3D -1; + + overshoot_handled =3D 1; } if (lcols_given) to_x =3D window_column_x (w, window, extract_float (lcols), lcols); @@ -2159,7 +2162,7 @@ whether or not it is currently displayed in some wind= ow. */) } else if (overshoot_handled) { - it.vpos =3D 0; + it.vpos =3D vpos_init; move_it_by_lines (&it, min (PTRDIFF_MAX, nlines)); } else --=20 2.4.1