unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: bojohan@gnu.org
Cc: 9229@debbugs.gnu.org
Subject: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 22:13:16 +0300	[thread overview]
Message-ID: <837h6upaur.fsf@gnu.org> (raw)
In-Reply-To: <83ei12a2n2.fsf@gnu.org>

> Date: Wed, 03 Aug 2011 19:19:45 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 9229@debbugs.gnu.org
> 
> > From: Johan Bockgård <bojohan@gnu.org>
> > Date: Wed, 03 Aug 2011 16:29:52 +0200
> > 
> > 
> >     (let ((o (make-overlay (point-max) (point-max)))
> >           (s (make-string (+ 5 (window-width)) ?-)))
> >       (put-text-property 0 1 'cursor t s)
> >       (overlay-put o 'after-string s)
> >       (goto-char (point-max)))
> > 
> > The cursor is expected to be displayed before the overlay, but is
> > displayed after it.
> > 
> > (This bug makes icomplete-mode very confusing to use.)

Does the patch below give good results?  If it solves this particular
problem, please try it in your regular use for a day or two, and see
if there are any adverse effects.  If you don't spot any trouble, I
will install this on the trunk.

Thanks.

Here's the patch to try:

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-08-03 05:24:30 +0000
+++ src/xdisp.c	2011-08-03 19:04:49 +0000
@@ -13706,14 +13706,15 @@ set_cursor_from_row (struct window *w, s
       w->cursor.vpos >= 0
       /* that candidate is not the row we are processing */
       && MATRIX_ROW (matrix, w->cursor.vpos) != row
-      /* the row we are processing is part of a continued line */
-      && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row))
       /* Make sure cursor.vpos specifies a row whose start and end
 	 charpos occlude point.  This is because some callers of this
 	 function leave cursor.vpos at the row where the cursor was
 	 displayed during the last redisplay cycle.  */
       && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old
-      && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)))
+      && (pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
+	  /* the entire line is from display string */
+	  || (pt_old == MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
+	      && pt_old == MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)))))
     {
       struct glyph *g1 =
 	MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos;
@@ -13722,15 +13723,20 @@ set_cursor_from_row (struct window *w, s
       if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end))
 	return 0;
       /* Keep the candidate whose buffer position is the closest to
-	 point.  */
+	 point or has the `cursor' property.  */
       if (/* previous candidate is a glyph in TEXT_AREA of that row */
 	  w->cursor.hpos >= 0
 	  && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos)
-	  && BUFFERP (g1->object)
-	  && (g1->charpos == pt_old /* an exact match always wins */
-	      || (BUFFERP (glyph->object)
-		  && eabs (g1->charpos - pt_old)
-		   < eabs (glyph->charpos - pt_old))))
+	  && ((BUFFERP (g1->object)
+	       && (g1->charpos == pt_old /* an exact match always wins */
+		   || (BUFFERP (glyph->object)
+		       && eabs (g1->charpos - pt_old)
+		       < eabs (glyph->charpos - pt_old))))
+	      /* previous candidate is a glyph from a string that has
+		 a non-nil `cursor' property */
+	      || (STRINGP (g1->object)
+		  && !NILP (Fget_char_property (make_number (g1->charpos),
+						Qcursor, g1->object)))))
 	return 0;
       /* If this candidate gives an exact match, use that.  */
       if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old)







  reply	other threads:[~2011-08-03 19:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 14:29 bug#9229: 24.0.50; Bidi problem with `cursor' property Johan Bockgård
2011-08-03 16:19 ` Eli Zaretskii
2011-08-03 19:13   ` Eli Zaretskii [this message]
2011-08-03 20:03     ` Johan Bockgård
2011-08-03 20:41       ` Eli Zaretskii
2011-08-04 16:26         ` Eli Zaretskii
2011-08-04 16:45           ` Johan Bockgård
2011-08-05 10:34             ` Eli Zaretskii

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=837h6upaur.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=9229@debbugs.gnu.org \
    --cc=bojohan@gnu.org \
    /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).