changeset 107732:dc45468b3140

Fix bug #5816. xdisp.c (set_cursor_from_row): Fix cursor positioning when the string with `cursor' property comes from an `after-string' overlay.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 01 Apr 2010 15:37:28 +0300
parents 64415eac89e1
children 84b961690802 5a619d0a9158
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Apr 01 10:55:55 2010 +0000
+++ b/src/ChangeLog	Thu Apr 01 15:37:28 2010 +0300
@@ -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):
--- a/src/xdisp.c	Thu Apr 01 10:55:55 2010 +0000
+++ b/src/xdisp.c	Thu Apr 01 15:37:28 2010 +0300
@@ -12823,12 +12823,19 @@
 
 		  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 @@
 				}
 			    }
 
-			  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.  */