# HG changeset patch # User Eli Zaretskii # Date 1262347283 18000 # Node ID 0e2486128193fb68ede470510a8545aaefcaf8b1 # Parent d44bdcba4457cc666d550d4d90d71a50401ebe2b 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. diff -r d44bdcba4457 -r 0e2486128193 src/ChangeLog.bidi --- 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 + + * 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 * xdisp.c (init_iterator, text_outside_line_unchanged_p) diff -r d44bdcba4457 -r 0e2486128193 src/xdisp.c --- 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;