+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
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;
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);
}
&& *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);
}
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);
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;
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;
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
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 */
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 *);
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);
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);
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;
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
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)
{
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);
}
}
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);
}
}
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;
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)
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);
}
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);
}
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);
}
}
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);