GNU bug report logs - #9229
24.0.50; Bidi problem with `cursor' property

Previous Next

Package: emacs;

Reported by: Johan Bockgård <bojohan <at> gnu.org>

Date: Wed, 3 Aug 2011 14:31:02 UTC

Severity: normal

Found in version 24.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9229 in the body.
You can then email your comments to 9229 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Wed, 03 Aug 2011 14:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Johan Bockgård <bojohan <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Aug 2011 14:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Johan Bockgård <bojohan <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 16:29:52 +0200
The `cursor' property does not work properly on overlays when
bidi-display-reordering is t and the overlay string is line wrapped.

   emacs -Q

Eval

    (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.)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Wed, 03 Aug 2011 16:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Johan Bockgוrd <bojohan <at> gnu.org>
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 19:19:45 +0300
> From: Johan Bockgård <bojohan <at> 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.)

Thanks, I will get to this soon.  Sorry for the inconvenience.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Wed, 03 Aug 2011 19:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bojohan <at> gnu.org
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 22:13:16 +0300
> Date: Wed, 03 Aug 2011 19:19:45 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 9229 <at> debbugs.gnu.org
> 
> > From: Johan Bockgård <bojohan <at> 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)






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Wed, 03 Aug 2011 20:05:02 GMT) Full text and rfc822 format available.

Message #14 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Johan Bockgård <bojohan <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 22:03:51 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Wed, 03 Aug 2011 19:19:45 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> Cc: 9229 <at> debbugs.gnu.org
>> 
>> > From: Johan Bockgård <bojohan <at> 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.

Apparently, the patch only tries to fix the case where "the entire line
is from display string", which doesn't solve the icomplete problem:

emacs -Q

M-x icomplete-mode RET

M-x a




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Wed, 03 Aug 2011 20:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Johan Bockgֳ¥rd <bojohan <at> gnu.org>
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Wed, 03 Aug 2011 23:41:49 +0300
> From: Johan Bockgård <bojohan <at> gnu.org>
> Cc: 9229 <at> debbugs.gnu.org
> Date: Wed, 03 Aug 2011 22:03:51 +0200
> 
> Apparently, the patch only tries to fix the case where "the entire line
> is from display string", which doesn't solve the icomplete problem:
> 
> emacs -Q
> 
> M-x icomplete-mode RET
> 
> M-x a

What about this one?  (Apply it after "bzr revert".)

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-08-03 05:24:30 +0000
+++ src/xdisp.c	2011-08-03 20:33:08 +0000
@@ -13706,14 +13706,12 @@ 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)))
     {
       struct glyph *g1 =
 	MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos;
@@ -13722,15 +13720,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)






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Thu, 04 Aug 2011 16:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bojohan <at> gnu.org
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Thu, 04 Aug 2011 19:26:43 +0300
> Date: Wed, 03 Aug 2011 23:41:49 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 9229 <at> debbugs.gnu.org
> 
> > From: Johan Bockgård <bojohan <at> gnu.org>
> > Cc: 9229 <at> debbugs.gnu.org
> > Date: Wed, 03 Aug 2011 22:03:51 +0200
> > 
> > Apparently, the patch only tries to fix the case where "the entire line
> > is from display string", which doesn't solve the icomplete problem:
> > 
> > emacs -Q
> > 
> > M-x icomplete-mode RET
> > 
> > M-x a
> 
> What about this one?  (Apply it after "bzr revert".)

Any experience with this patch, positive or otherwise?

TIA





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9229; Package emacs. (Thu, 04 Aug 2011 16:47:01 GMT) Full text and rfc822 format available.

Message #23 received at 9229 <at> debbugs.gnu.org (full text, mbox):

From: Johan Bockgård <bojohan <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9229 <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Thu, 04 Aug 2011 18:45:51 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Any experience with this patch, positive or otherwise?

It works so far. Thanks.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 05 Aug 2011 10:38:02 GMT) Full text and rfc822 format available.

Notification sent to Johan Bockgård <bojohan <at> gnu.org>:
bug acknowledged by developer. (Fri, 05 Aug 2011 10:38:03 GMT) Full text and rfc822 format available.

Message #28 received at 9229-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Johan Bockgוrd <bojohan <at> gnu.org>
Cc: 9229-done <at> debbugs.gnu.org
Subject: Re: bug#9229: 24.0.50; Bidi problem with `cursor' property
Date: Fri, 05 Aug 2011 13:34:16 +0300
> From: Johan Bockgård <bojohan <at> gnu.org>
> Cc: 9229 <at> debbugs.gnu.org
> Date: Thu, 04 Aug 2011 18:45:51 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Any experience with this patch, positive or otherwise?
> 
> It works so far. Thanks.

Committed as revision 105406 on the trunk.  Thanks.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Sep 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 293 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.