]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #5816.
authorEli Zaretskii <eliz@gnu.org>
Thu, 1 Apr 2010 12:37:28 +0000 (15:37 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 1 Apr 2010 12:37:28 +0000 (15:37 +0300)
 xdisp.c (set_cursor_from_row): Fix cursor positioning when the
 string with `cursor' property comes from an `after-string' overlay.

src/ChangeLog
src/xdisp.c

index a2abfab37275474ef527596d7af8fce9009ab0ba..df0453a341bf3033664c74445cd7878a879c8e7e 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (set_cursor_from_row): Fix cursor positioning when the
+       string with `cursor' property comes from an `after-string'
+       overlay.  (Bug#5816)
+
 2010-04-01  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (LIBTIFF, LIBJPEG, LIBPNG, LIBGIF, LIBXPM, XFT_LIBS):
index 709ff5f6d68ae6e9a1f4f09965d6395b30ee21a5..c6ae6ad4c147f9ff29cc4da8a1b43ceef80fde0d 100644 (file)
@@ -12823,12 +12823,19 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
 
                  str = glyph->object;
                  tem = string_buffer_position_lim (w, str, pos, pos_after, 0);
-                 if (pos <= tem)
+                 if (tem == 0  /* from overlay */
+                     || 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 (tem == pt_old)
+                        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)
                        {
                          /* The glyphs from this string could have
                             been reordered.  Find the one with the
@@ -12861,9 +12868,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
                                }
                            }
 
-                         goto compute_x;
+                         if (tem == pt_old)
+                           goto compute_x;
                        }
-                     pos = tem + 1; /* don't find previous instances */
+                     if (tem)
+                       pos = tem + 1; /* don't find previous instances */
                    }
                  /* This string is not what we want; skip all of the
                     glyphs that came from it.  */