diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-06-08 21:28:36 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-06-08 21:28:36 +0300 |
commit | 5bf97bfc6730fa2a4ca187cadbb689d79178eafc (patch) | |
tree | c9d5b7044991216bc3b8e5b50a49ba66537d245d | |
parent | b33f93eea9ddf94aaa4c48b9c057a58b8fa2b6c9 (diff) | |
download | emacs-5bf97bfc6730fa2a4ca187cadbb689d79178eafc.tar.gz emacs-5bf97bfc6730fa2a4ca187cadbb689d79178eafc.tar.bz2 emacs-5bf97bfc6730fa2a4ca187cadbb689d79178eafc.zip |
Fix bug #14575 with window-specific overlays with display props.
src/bidi.c (bidi_fetch_char): Accept additional argument, the window
being displayed, and pass it to compute_display_string_pos.
(bidi_level_of_next_char, bidi_resolve_explicit_1)
(bidi_paragraph_init): All callers changed.
src/xdisp.c (init_from_display_pos, init_iterator)
(handle_single_display_spec, next_overlay_string)
(get_overlay_strings_1, reseat_1, reseat_to_string)
(push_prefix_prop, Fcurrent_bidi_paragraph_direction): Set
bidi_it.w member from it->w.
(compute_display_string_pos): Accept additional argument, the
window being displayed, and pass it to Fget_char_property.
src/dispextern.h (struct bidi_it): New member w, the window being
displayed.
(compute_display_string_pos): Adjust prototype.
-rw-r--r-- | src/ChangeLog | 20 | ||||
-rw-r--r-- | src/bidi.c | 14 | ||||
-rw-r--r-- | src/dispextern.h | 3 | ||||
-rw-r--r-- | src/xdisp.c | 27 |
4 files changed, 54 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 629f90678e6..cf5a8c0ee1e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2013-06-08 Eli Zaretskii <eliz@gnu.org> + + * bidi.c (bidi_fetch_char): Accept additional argument, the window + being displayed, and pass it to compute_display_string_pos. + (bidi_level_of_next_char, bidi_resolve_explicit_1) + (bidi_paragraph_init): All callers changed. + + * xdisp.c (init_from_display_pos, init_iterator) + (handle_single_display_spec, next_overlay_string) + (get_overlay_strings_1, reseat_1, reseat_to_string) + (push_prefix_prop, Fcurrent_bidi_paragraph_direction): Set + bidi_it.w member from it->w. + (compute_display_string_pos): Accept additional argument, the + window being displayed, and pass it to Fget_char_property. + (Bug#14575) + + * dispextern.h (struct bidi_it): New member w, the window being + displayed. + (compute_display_string_pos): Adjust prototype. + 2013-06-08 Jan Djärv <jan.h.d@swipnet.se> * xgselect.c: Remove unneeded include xterm.h diff --git a/src/bidi.c b/src/bidi.c index c6bea62f67b..c31d208ecbc 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -927,6 +927,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) static int bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, int *disp_prop, struct bidi_string_data *string, + struct window *w, bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) { int ch; @@ -940,7 +941,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, if (charpos < endpos && charpos > *disp_pos) { SET_TEXT_POS (pos, charpos, bytepos); - *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, + *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, disp_prop); } @@ -1045,7 +1046,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, && *disp_prop) { SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); - *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, + *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, disp_prop); } @@ -1224,7 +1225,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) if (!string_p) pos = BYTE_TO_CHAR (bytepos); ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, - &bidi_it->string, + &bidi_it->string, bidi_it->w, bidi_it->frame_window_p, &ch_len, &nchars); type = bidi_get_type (ch, NEUTRAL_DIR); @@ -1252,7 +1253,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) break; /* Fetch next character and advance to get past it. */ ch = bidi_fetch_char (pos, bytepos, &disp_pos, - &disp_prop, &bidi_it->string, + &disp_prop, &bidi_it->string, bidi_it->w, bidi_it->frame_window_p, &ch_len, &nchars); pos += nchars; bytepos += ch_len; @@ -1402,7 +1403,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) a single character u+FFFC. */ curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, &bidi_it->disp_pos, &bidi_it->disp_prop, - &bidi_it->string, bidi_it->frame_window_p, + &bidi_it->string, bidi_it->w, + bidi_it->frame_window_p, &bidi_it->ch_len, &bidi_it->nchars); } bidi_it->ch = curchar; @@ -2194,7 +2196,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) emacs_abort (); do { ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, - fwp, &clen, &nc); + bidi_it->w, fwp, &clen, &nc); if (ch == '\n' || ch == BIDI_EOB) chtype = NEUTRAL_B; else diff --git a/src/dispextern.h b/src/dispextern.h index 50a32ffaf8f..83e8792dfe0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1881,6 +1881,7 @@ struct bidi_it { stuff that is not part of the bidi iterator's state! */ struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ struct bidi_string_data string; /* string to reorder */ + struct window *w; /* the window being displayed */ bidi_dir_t paragraph_dir; /* current paragraph direction */ ptrdiff_t separator_limit; /* where paragraph separator should end */ unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ @@ -3077,7 +3078,7 @@ extern void reseat_at_previous_visible_line_start (struct it *); extern Lisp_Object lookup_glyphless_char_display (int, struct it *); extern ptrdiff_t compute_display_string_pos (struct text_pos *, struct bidi_string_data *, - int, int *); + struct window *, int, int *); extern ptrdiff_t compute_display_string_end (ptrdiff_t, struct bidi_string_data *); extern void produce_stretch_glyph (struct it *); diff --git a/src/xdisp.c b/src/xdisp.c index 6e391350816..5ec72407191 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2650,6 +2650,7 @@ init_iterator (struct it *it, struct window *w, it->bidi_it.string.lstring = Qnil; it->bidi_it.string.s = NULL; it->bidi_it.string.bufpos = 0; + it->bidi_it.w = w; /* The window in which we iterate over current_buffer: */ XSETWINDOW (it->window, w); @@ -3124,6 +3125,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) it->bidi_it.string.bufpos = it->overlay_strings_charpos; it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); @@ -3490,11 +3492,11 @@ next_overlay_change (ptrdiff_t pos) ptrdiff_t compute_display_string_pos (struct text_pos *position, struct bidi_string_data *string, + struct window *w, int frame_window_p, int *disp_prop) { /* OBJECT = nil means current buffer. */ - Lisp_Object object = - (string && STRINGP (string->lstring)) ? string->lstring : Qnil; + Lisp_Object object, object1; Lisp_Object pos, spec, limpos; int string_p = (string && (STRINGP (string->lstring) || string->s)); ptrdiff_t eob = string_p ? string->schars : ZV; @@ -3505,6 +3507,17 @@ compute_display_string_pos (struct text_pos *position, struct text_pos tpos; int rv = 0; + if (string && STRINGP (string->lstring)) + object1 = object = string->lstring; + else if (!string_p) + { + eassert (w != NULL); + XSETWINDOW (object, w); + object1 = Qnil; + } + else + object1 = object = Qnil; + *disp_prop = 1; if (charpos >= eob @@ -3543,7 +3556,7 @@ compute_display_string_pos (struct text_pos *position, that will replace the underlying text when displayed. */ limpos = make_number (lim); do { - pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos); + pos = Fnext_single_char_property_change (pos, Qdisplay, object1, limpos); CHARPOS (tpos) = XFASTINT (pos); if (CHARPOS (tpos) >= lim) { @@ -5031,6 +5044,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, it->bidi_it.string.bufpos = bufpos; it->bidi_it.string.from_disp_str = 1; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); } } @@ -5409,6 +5423,7 @@ next_overlay_string (struct it *it) it->bidi_it.string.bufpos = it->overlay_strings_charpos; it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); } } @@ -5712,6 +5727,7 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p) it->bidi_it.string.bufpos = pos; it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); } return 1; @@ -6344,6 +6360,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) it->bidi_it.string.lstring = Qnil; it->bidi_it.string.bufpos = 0; it->bidi_it.string.unibyte = 0; + it->bidi_it.w = it->w; } if (set_stop_p) @@ -6421,6 +6438,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, it->bidi_it.string.bufpos = 0; it->bidi_it.string.from_disp_str = 0; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); } @@ -6452,6 +6470,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, it->bidi_it.string.bufpos = 0; it->bidi_it.string.from_disp_str = 0; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); } @@ -18921,6 +18940,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop) it->bidi_it.string.bufpos = IT_CHARPOS (*it); it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; it->bidi_it.string.unibyte = !it->multibyte_p; + it->bidi_it.w = it->w; bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); } } @@ -19990,6 +20010,7 @@ See also `bidi-paragraph-direction'. */) itb.string.lstring = Qnil; itb.string.bufpos = 0; itb.string.unibyte = 0; + itb.w = XWINDOW (selected_window); bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); bidi_unshelve_cache (itb_data, 0); set_buffer_temp (old); |