bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11094: Wrong cursor positioning with display+invisible


From: Eli Zaretskii
Subject: bug#11094: Wrong cursor positioning with display+invisible
Date: Sat, 07 Apr 2012 15:07:34 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]