From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: Bug in vertical-motion vs overlay with display property Date: Fri, 12 Apr 2013 19:34:24 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1365809676 28743 80.91.229.3 (12 Apr 2013 23:34:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2013 23:34:36 +0000 (UTC) Cc: alp.tekin.aker@gmail.com, Emacs Developement List To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 13 01:34:40 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UQnUN-0005xt-J4 for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2013 01:34:39 +0200 Original-Received: from localhost ([::1]:41918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQnUN-0002Oq-2m for ged-emacs-devel@m.gmane.org; Fri, 12 Apr 2013 19:34:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQnUH-0002Oh-C1 for emacs-devel@gnu.org; Fri, 12 Apr 2013 19:34:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQnUE-0005GK-CV for emacs-devel@gnu.org; Fri, 12 Apr 2013 19:34:33 -0400 Original-Received: from honk.quarl.org ([173.45.230.109]:47875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQnU9-0005BL-OW; Fri, 12 Apr 2013 19:34:25 -0400 Original-Received: by honk.quarl.org (Postfix, from userid 1000) id C3158A867A; Fri, 12 Apr 2013 19:34:24 -0400 (EDT) X-Hashcash: 1:20:130412:eliz@gnu.org::kFkpDBl2G0visd3i:000009lxL X-Hashcash: 1:20:130412:alp.tekin.aker@gmail.com::feotfpkDfYkU2Ib1:00000000000000000000000000000000000001TbS X-Hashcash: 1:20:130412:emacs-devel@gnu.org::qP6zHZikLpaBtwHR:0000000000000000000000000000000000000000003b1y X-Quack-Archive: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 173.45.230.109 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158866 Archived-At: Hi Eli/Emacs-devel, I believe I've discovered a small bug in `vertical-motion' in indent.c. It affects movement past blank lines when there is an overlay with a display/cursor property. When using `fci-mode' from fill-column-indicator.el, `previous-line' sometimes goes past two blank lines instead of one. Affected Emacs versions: - Good: 24.2 - BAD: 24.3 - BAD: 24.3.50 as of 2013-04-08 1. One can reproduce the problem using fill-column-indicator.el: $ wget https://raw.github.com/alpaker/Fill-Column-Indicator/master/fill-column-indicator.el $ emacs -Q M-x load-file fill-column-indicator.el M-x fci-mode ;; BAD: this moves up 2 lines instead of 1 line 2. I minimized the above down to the following self-contained test case: $ cat > aa.el < AuthorDate: 2012-11-21 21:28:14 +0200 Commit: Eli Zaretskii CommitDate: 2012-11-21 21:28:14 +0200 Fix bug #12930 with vertical-motion through a display string. src/indent.c (Fvertical_motion): If the starting position is covered by a display string, return to one position before that, to avoid overshooting it inside move_it_to. --- src/ChangeLog | 6 ++++++ src/indent.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 020948e..c51f58a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-21 Eli Zaretskii + + * indent.c (Fvertical_motion): If the starting position is covered + by a display string, return to one position before that, to avoid + overshooting it inside move_it_to. (Bug#12930) + 2012-11-20 Daniel Colascione * w32fns.c (Fx_file_dialog): diff --git a/src/indent.c b/src/indent.c index bbc944d..3332228 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2057,7 +2057,13 @@ whether or not it is currently displayed in some window. */) comment said this is "so we don't move too far" (2005-01-19 checkin by kfs). But this does nothing useful that I can tell, and it causes Bug#2694 . -- cyd */ - move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); + /* When the position we started from is covered by a display + string, move_it_to will overshoot it, while vertical-motion + wants to put the cursor _before_ the display string. So in + that case, we move to buffer position before the display + string, and avoid overshooting. */ + move_it_to (&it, disp_string_at_start_p ? PT - 1 : PT, + -1, -1, -1, MOVE_TO_POS); /* IT may move too far if truncate-lines is on and PT lies beyond the right margin. IT may also move too far if the Thoughts? Thanks, Karl