changeset 108195:d3d8bc38d005

Fix a crash when a display string is continued to the next line. xdisp.c (set_cursor_from_row): When looping over a display string, don't overstep the end of the glyph row.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 27 Apr 2010 22:40:05 +0300
parents 65bda6b7d8b9
children c52b9f1b020e
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Apr 25 22:33:31 2010 +0300
+++ b/src/ChangeLog	Tue Apr 27 22:40:05 2010 +0300
@@ -1,3 +1,8 @@
+2010-04-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (set_cursor_from_row): Fix a crash when a display string
+	is continued to the next line.
+
 2010-04-25  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (set_cursor_from_row): Don't return zero if cursor was
--- a/src/xdisp.c	Sun Apr 25 22:33:31 2010 +0300
+++ b/src/xdisp.c	Tue Apr 27 22:40:05 2010 +0300
@@ -13015,7 +13015,8 @@
 
 			  cursor = glyph;
 			  for (glyph += incr;
-			       EQ (glyph->object, str);
+			       (row->reversed_p ? glyph > stop : glyph < stop)
+				 && EQ (glyph->object, str);
 			       glyph += incr)
 			    {
 			      Lisp_Object cprop;
@@ -13056,8 +13057,8 @@
 	  /* If we reached the end of the line, and END was from a string,
 	     the cursor is not on this line.  */
 	  if (cursor == NULL
-	      && glyph == end
-	      && STRINGP ((glyph - incr)->object)
+	      && (row->reversed_p ? glyph <= end : glyph >= end)
+	      && STRINGP (end->object)
 	      && row->continued_p)
 	    return 0;
 	}