unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 11094@debbugs.gnu.org
Subject: bug#11094: Wrong cursor positioning with display+invisible
Date: Sat, 07 Apr 2012 15:07:34 +0300	[thread overview]
Message-ID: <83pqbjagop.fsf@gnu.org> (raw)
In-Reply-To: <jwv4nt1vsyv.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> 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)






  reply	other threads:[~2012-04-07 12:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  4:07 bug#11094: Wrong cursor positioning with display+invisible Stefan Monnier
2012-03-31  9:33 ` Eli Zaretskii
2012-04-02  1:06   ` Stefan Monnier
2012-04-02  2:56     ` Eli Zaretskii
2012-04-02 13:09       ` Stefan Monnier
2012-04-02 16:51         ` Eli Zaretskii
2012-04-02 20:15           ` Stefan Monnier
2012-04-02 21:06             ` Eli Zaretskii
2012-04-03 13:37               ` Stefan Monnier
2012-04-07 12:07                 ` Eli Zaretskii [this message]
2012-04-09  2:23                   ` Stefan Monnier
2012-04-09  8:02                     ` Eli Zaretskii
2012-04-09 13:21                       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pqbjagop.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11094@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).