From: Kim F. Storm Date: Sun, 19 Mar 2006 19:38:48 +0000 (+0000) Subject: (set_cursor_from_row): Fix cursor property on overlay string, X-Git-Tag: emacs-pretest-22.0.90~3520 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3dcef10bbc435cc2d2b89670366500603fd6f31b;p=emacs.git (set_cursor_from_row): Fix cursor property on overlay string, so it doesn't associate overlay string with following glyph by default. Allow integer property value to specify explicit number of buffer positions associate with overlay string. --- diff --git a/src/xdisp.c b/src/xdisp.c index 9481bbbc153..7b1c5cd96fb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11604,7 +11604,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) x += glyph->pixel_width; ++glyph; if (cursor_from_overlay_pos - && last_pos > cursor_from_overlay_pos) + && last_pos >= cursor_from_overlay_pos) { cursor_from_overlay_pos = 0; cursor = 0; @@ -11618,10 +11618,12 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) /* Skip all glyphs from string. */ do { + Lisp_Object cprop; int pos; if ((cursor == NULL || glyph > cursor) - && !NILP (Fget_char_property (make_number ((glyph)->charpos), - Qcursor, (glyph)->object)) + && (cprop = Fget_char_property (make_number ((glyph)->charpos), + Qcursor, (glyph)->object), + !NILP (cprop)) && (pos = string_buffer_position (w, glyph->object, string_before_pos), (pos == 0 /* From overlay */ @@ -11632,14 +11634,15 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) Add 1 to last_pos so that if point corresponds to the glyph right after the overlay, we still use a 'cursor' property found in that overlay. */ - cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0; + cursor_from_overlay_pos = (pos ? 0 : last_pos + + (INTEGERP (cprop) ? XINT (cprop) : 0)); cursor = glyph; cursor_x = x; } x += glyph->pixel_width; ++glyph; } - while (glyph < end && STRINGP (glyph->object)); + while (glyph < end && EQ (glyph->object, string_start->object)); } }