From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#11094: Wrong cursor positioning with display+invisible Date: Sat, 07 Apr 2012 15:07:34 +0300 Message-ID: <83pqbjagop.fsf@gnu.org> References: <83vclljesi.fsf@gnu.org> <83wr5yj0yl.fsf@gnu.org> <83vclihyal.fsf@gnu.org> <83vclhdes4.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1333800626 8907 80.91.229.3 (7 Apr 2012 12:10:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 7 Apr 2012 12:10:26 +0000 (UTC) Cc: 11094@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 07 14:10:25 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 1SGUTI-0005LM-HA for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Apr 2012 14:10:24 +0200 Original-Received: from localhost ([::1]:51181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGUTH-0004si-NJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Apr 2012 08:10:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGUTE-0004sa-Hc for bug-gnu-emacs@gnu.org; Sat, 07 Apr 2012 08:10:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGUTC-0002TL-FR for bug-gnu-emacs@gnu.org; Sat, 07 Apr 2012 08:10:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGUTC-0002TG-Bq for bug-gnu-emacs@gnu.org; Sat, 07 Apr 2012 08:10:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SGUTt-0000x4-Ms for bug-gnu-emacs@gnu.org; Sat, 07 Apr 2012 08:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Apr 2012 12:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11094-submit@debbugs.gnu.org id=B11094.13338006253614 (code B ref 11094); Sat, 07 Apr 2012 12:11:01 +0000 Original-Received: (at 11094) by debbugs.gnu.org; 7 Apr 2012 12:10:25 +0000 Original-Received: from localhost ([127.0.0.1]:43132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGUTJ-0000wF-2X for submit@debbugs.gnu.org; Sat, 07 Apr 2012 08:10:25 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:32980) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGUTF-0000w5-M4 for 11094@debbugs.gnu.org; Sat, 07 Apr 2012 08:10:23 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M2300800YXPPI00@a-mtaout22.012.net.il> for 11094@debbugs.gnu.org; Sat, 07 Apr 2012 15:09:34 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.229.252.114]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M2300884Z3XDAD0@a-mtaout22.012.net.il>; Sat, 07 Apr 2012 15:09:34 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il 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:58571 Archived-At: > From: Stefan Monnier > Cc: 11094@debbugs.gnu.org > Date: Tue, 03 Apr 2012 09:37:08 -0400 > > >> emacs -Q > >> (put-text-property (point-min) (+ 2 (point-min)) 'invisible t) > >> (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>") > >> (goto-char (point-min)) > >> where I'd expect the cursor to be drawn to the left of "<>" rather than > >> to the right. > > Isn't this an issue with point adjustments? > > No: the (goto-char (point-min)) really moves to (point-min) for me, as > can be verified with M-: (point). > > > If I set global-disable-point-adjustment non-nil, I get the cursor > > where you want it. > > It makes no difference for me: point as at BOB, but the cursor is drawn > after the "<>". The patch below solves this problem. Do you think it is safe enough for the release branch? === modified file 'src/xdisp.c' --- src/xdisp.c 2012-03-31 19:30:53 +0000 +++ src/xdisp.c 2012-04-07 11:58:19 +0000 @@ -14042,15 +14042,18 @@ set_cursor_from_row (struct window *w, s || pos <= tem) { /* If the string from which this glyph came is - found in the buffer at point, then we've - found the glyph we've been looking for. If - it comes from an overlay (tem == 0), and it - has the `cursor' property on one of its + found in the buffer at point, or at position + that is closer to point than pos_after, then + we've found the glyph we've been looking for. + If it comes from an overlay (tem == 0), and + it has the `cursor' property on one of its glyphs, record that glyph as a candidate for displaying the cursor. (As in the unidirectional version, we will display the cursor on the last candidate we find.) */ - if (tem == 0 || tem == pt_old) + if (tem == 0 + || tem == pt_old + || (tem - pt_old > 0 && tem < pos_after)) { /* The glyphs from this string could have been reordered. Find the one with the @@ -14088,7 +14091,8 @@ set_cursor_from_row (struct window *w, s } } - if (tem == pt_old) + if (tem == pt_old + || (tem - pt_old > 0 && tem < pos_after)) goto compute_x; } if (tem)