changeset 107603:0e2486128193

Retrospective commit from 2009-11-21. Fix cursor positioning on empty lines with overlays. xdisp.c (set_cursor_from_row): Fix cursor positioning on empty lines when integer values of `cursor' property is used on display strings.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 01 Jan 2010 07:01:23 -0500
parents d44bdcba4457
children 9e8415b885ee
files src/ChangeLog.bidi src/xdisp.c
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog.bidi	Fri Jan 01 06:57:39 2010 -0500
+++ b/src/ChangeLog.bidi	Fri Jan 01 07:01:23 2010 -0500
@@ -1,3 +1,9 @@
+2009-11-21  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
+	lines when integer values of `cursor' property is used on display
+	strings.
+
 2009-11-14  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (init_iterator, text_outside_line_unchanged_p)
--- a/src/xdisp.c	Fri Jan 01 06:57:39 2010 -0500
+++ b/src/xdisp.c	Fri Jan 01 07:01:23 2010 -0500
@@ -12468,8 +12468,8 @@
   /* Non-zero means we've seen at least one glyph that came from a
      display string.  */
   int string_seen = 0;
-  /* Largest buffer position seen during scan of glyph row.  */
-  EMACS_INT bpos_max = 0;
+  /* Largest buffer position seen so far during scan of glyph row.  */
+  EMACS_INT bpos_max = last_pos;
   /* Last buffer position covered by an overlay string with an integer
      `cursor' property.  */
   EMACS_INT bpos_covered = 0;
@@ -12596,7 +12596,10 @@
 		/* If the `cursor' property covers buffer positions up
 		   to and including point, we should display cursor on
 		   this glyph.  */
-		if (bpos_covered >= pt_old)
+		/* Implementation note: bpos_max == pt_old when, e.g.,
+		   we are in an empty line, where bpos_max is set to
+		   MATRIX_ROW_START_CHARPOS, see above.  */
+		if (bpos_max <= pt_old && bpos_covered >= pt_old)
 		  {
 		    cursor = glyph;
 		    break;
@@ -12651,7 +12654,7 @@
 		/* If the `cursor' property covers buffer positions up
 		   to and including point, we should display cursor on
 		   this glyph.  */
-		if (bpos_covered >= pt_old)
+		if (bpos_max <= pt_old && bpos_covered >= pt_old)
 		  {
 		    cursor = glyph;
 		    break;