From: Eli Zaretskii Date: Fri, 1 Jan 2010 12:01:23 +0000 (-0500) Subject: Retrospective commit from 2009-11-21. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~635^2~43 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17a024a87de4008cd6cf94dd3b780efc7ace9a01;p=emacs.git 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 --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index 2f800e5ecd2..e3e1eddab75 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi @@ -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 --git a/src/xdisp.c b/src/xdisp.c index 180031be055..2d5314c7f83 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12468,8 +12468,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) /* 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 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) /* 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 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) /* 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;