From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Cursor positioning with `after-string' overlays Date: Sat, 03 Apr 2010 13:28:44 +0300 Message-ID: <83mxxk25k3.fsf@gnu.org> References: <83bpe3xqjj.fsf@gnu.org> <83ljd6w9p1.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1270290596 8651 80.91.229.12 (3 Apr 2010 10:29:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 3 Apr 2010 10:29:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 03 12:29:52 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ny0bw-0000sj-2G for ged-emacs-devel@m.gmane.org; Sat, 03 Apr 2010 12:29:52 +0200 Original-Received: from localhost ([127.0.0.1]:33839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ny0bv-00060G-AH for ged-emacs-devel@m.gmane.org; Sat, 03 Apr 2010 06:29:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ny0bp-0005z5-Ng for emacs-devel@gnu.org; Sat, 03 Apr 2010 06:29:45 -0400 Original-Received: from [140.186.70.92] (port=41326 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ny0bo-0005xM-04 for emacs-devel@gnu.org; Sat, 03 Apr 2010 06:29:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ny0bm-0000mw-CJ for emacs-devel@gnu.org; Sat, 03 Apr 2010 06:29:43 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:35005) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ny0bm-0000mp-3w for emacs-devel@gnu.org; Sat, 03 Apr 2010 06:29:42 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0L0A00600P2XLC00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 03 Apr 2010 13:28:41 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.124.92.42]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L0A006E3QFSQB20@a-mtaout22.012.net.il>; Sat, 03 Apr 2010 13:28:41 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123110 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Fri, 02 Apr 2010 14:17:31 -0400 > > >> But depending on the insertion-type of the end marker of your overlay, > >> text inserted "at point" will be inserted (visually) between the o and > >> the - rather than between the - and the b, so while this choice would > >> sometimes be correct, it's sometimes incorrect. > > > Sorry, I don't understand the specific situation. In my example, when > > the cursor is on `b', insertion happens between `-' and `b', which is > > visually correct. Can you modify my example to create the situation > > you are describing? Then I could try to reason about it and perhaps > > modify the code if necessary. > > Try: > > (let ((pos (goto-char (point-max)))) > (insert "foobar") > (overlay-put > (make-overlay (+ pos 2) (+ pos 3) nil nil t) > 'after-string (propertize "-" 'cursor t))) > > (i.e. I added "nil nil t" to the call to make-overlay). Yes, I see the issue now. However, the old redisplay has a similar problem when the additional arguments to make-overlay are "nil t nil": the cursor is placed on `-', but the first insertion appears _after_ `-'. So I'm not sure which one is better. Maybe using the marker insertion type (see my other email) will allow us to DTRT in each case.