From df907af0ddfc4282a6184f1b516cd92dbdf0093f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 11 Jun 2014 19:11:32 +0300 Subject: [PATCH] Fix bug #17744 with cursor motion near overlay string with 'cursor' prop. src/xdisp.c (set_cursor_from_row): Fix an off-by-one error when matching overlay strings with 'cursor' property against buffer positions traversed in the glyph row. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f7ee48d1d07..3468cea6159 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-06-11 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Fix an off-by-one error when + matching overlay strings with 'cursor' property against buffer + positions traversed in the glyph row. (Bug#17744) + 2014-06-08 Glenn Morris * fileio.c (write-region-inhibit-fsync): Doc tweak. diff --git a/src/xdisp.c b/src/xdisp.c index 1a5c29ac5be..f0eeb9ac601 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14421,7 +14421,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, pos_after, 0); if (prop_pos >= pos_before) - bpos_max = prop_pos - 1; + bpos_max = prop_pos; } if (INTEGERP (chprop)) { @@ -14495,7 +14495,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, pos_after, 0); if (prop_pos >= pos_before) - bpos_max = prop_pos - 1; + bpos_max = prop_pos; } if (INTEGERP (chprop)) { @@ -14525,7 +14525,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, GLYPH_BEFORE and GLYPH_AFTER. */ if (!((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end) && BUFFERP (glyph->object) && glyph->charpos == pt_old) - && !(bpos_max < pt_old && pt_old <= bpos_covered)) + && !(bpos_max <= pt_old && pt_old <= bpos_covered)) { /* An empty line has a single glyph whose OBJECT is zero and whose CHARPOS is the position of a newline on that line. -- 2.11.4.GIT