From: Eli Zaretskii Date: Fri, 19 Nov 2010 16:34:22 +0000 (+0200) Subject: Fix bug #6687 with cursor positioning after before-string from overlays. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~191 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f48fe1f074f1f9d263fef6b69b8b0780a9de126f;p=emacs.git Fix bug #6687 with cursor positioning after before-string from overlays. xdisp.c (set_cursor_from_row): Display cursor after all the glyphs that come from an overlay. Don't overstep the last glyph when skipping glyphs from an overlay. --- diff --git a/src/ChangeLog b/src/ChangeLog index 9c113a35a77..21e74725dc0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-19 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Display cursor after all the + glyphs that come from an overlay. Don't overstep the last glyph + when skipping glyphs from an overlay. (Bug#6687) + 2010-11-18 Dan Nicolaescu * alloc.c (refill_memory_reserve): Move declaration ... diff --git a/src/xdisp.c b/src/xdisp.c index e02abf6a5b5..b2d81cb60e9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12941,7 +12941,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor on that character's glyph. */ EMACS_INT strpos = glyph->charpos; - cursor = glyph; + if (tem) + cursor = glyph; for (glyph += incr; (row->reversed_p ? glyph > stop : glyph < stop) && EQ (glyph->object, str); @@ -12958,7 +12959,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor = glyph; break; } - if (glyph->charpos < strpos) + if (tem && glyph->charpos < strpos) { strpos = glyph->charpos; cursor = glyph; @@ -12973,10 +12974,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, } /* This string is not what we want; skip all of the glyphs that came from it. */ - do - glyph += incr; while ((row->reversed_p ? glyph > stop : glyph < stop) - && EQ (glyph->object, str)); + && EQ (glyph->object, str)) + glyph += incr; } else glyph += incr;