Commit fc6f18ce authored by Eli Zaretskii's avatar Eli Zaretskii

Discovery of replacing display properties now uses the same code

as the display engine.  Tested OK with display properties whose
value is a list.

 src/dispextern.h (struct bidi_it): New member frame_window_p.
 (bidi_init_it, compute_display_string_pos): Update prototypes.
 src/bidi.c (bidi_fetch_char): Accept additional argument
 FRAME_WINDOW_P and pass it to compute_display_string_pos.  All
 callers changed.
 (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
 it to initialize the frame_window_p member of struct bidi_it.
 src/xdisp.c (handle_display_spec): New function, refactored from the
 last portion of handle_display_prop.
 (compute_display_string_pos): Accept additional argument
 FRAME_WINDOW_P.  Call handle_display_spec to determine whether the
 value of a `display' property is a "replacing spec".
 (handle_single_display_spec): Accept 2 additional arguments BUFPOS
 and FRAME_WINDOW_P.  If IT is NULL, don't set up the iterator from
 the display property, but just return a value indicating whether
 the display property will replace the characters it covers.
 (Fcurrent_bidi_paragraph_direction): Initialize the nchars and
 frame_window_p members of struct bidi_it.
parent 683a44f7
2011-05-21 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (handle_display_spec): New function, refactored from the
last portion of handle_display_prop.
(compute_display_string_pos): Accept additional argument
FRAME_WINDOW_P. Call handle_display_spec to determine whether the
value of a `display' property is a "replacing spec".
(handle_single_display_spec): Accept 2 additional arguments BUFPOS
and FRAME_WINDOW_P. If IT is NULL, don't set up the iterator from
the display property, but just return a value indicating whether
the display property will replace the characters it covers.
(Fcurrent_bidi_paragraph_direction): Initialize the nchars and
frame_window_p members of struct bidi_it.
* bidi.c (bidi_fetch_char): Accept additional argument
FRAME_WINDOW_P and pass it to compute_display_string_pos. All
callers changed.
(bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
it to initialize the frame_window_p member of struct bidi_it.
* dispextern.h (struct bidi_it): New member frame_window_p.
(bidi_init_it, compute_display_string_pos): Update prototypes.
2011-05-14 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (compute_display_string_pos): Non-trivial implementation.
......
......@@ -581,7 +581,7 @@ bidi_line_init (struct bidi_it *bidi_it)
string. */
static INLINE int
bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
EMACS_INT *ch_len, EMACS_INT *nchars)
int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars)
{
int ch;
......@@ -589,7 +589,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
/* If we got past the last known position of display string, compute
the position of the next one. That position could be at BYTEPOS. */
if (charpos < ZV && charpos > *disp_pos)
*disp_pos = compute_display_string_pos (charpos);
*disp_pos = compute_display_string_pos (charpos, frame_window_p);
/* Fetch the character at BYTEPOS. */
if (bytepos >= ZV_BYTE)
......@@ -625,7 +625,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
/* If we just entered a run of characters covered by a display
string, compute the position of the next display string. */
if (charpos + *nchars <= ZV && charpos + *nchars > *disp_pos)
*disp_pos = compute_display_string_pos (charpos + *nchars);
*disp_pos = compute_display_string_pos (charpos + *nchars, frame_window_p);
return ch;
}
......@@ -754,7 +754,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
do {
bytepos = pstartbyte;
pos = BYTE_TO_CHAR (bytepos);
ch = bidi_fetch_char (bytepos, pos, &disp_pos, &ch_len, &nchars);
ch = bidi_fetch_char (bytepos, pos, &disp_pos, bidi_it->frame_window_p,
&ch_len, &nchars);
type = bidi_get_type (ch, NEUTRAL_DIR);
for (pos += nchars, bytepos += ch_len;
......@@ -778,7 +779,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
break;
}
/* Fetch next character and advance to get past it. */
ch = bidi_fetch_char (bytepos, pos, &disp_pos, &ch_len, &nchars);
ch = bidi_fetch_char (bytepos, pos, &disp_pos,
bidi_it->frame_window_p, &ch_len, &nchars);
pos += nchars;
bytepos += ch_len;
}
......@@ -840,12 +842,14 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it)
/* Initialize the bidi iterator from buffer/string position CHARPOS. */
void
bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it)
bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p,
struct bidi_it *bidi_it)
{
if (! bidi_initialized)
bidi_initialize ();
bidi_it->charpos = charpos;
bidi_it->bytepos = bytepos;
bidi_it->frame_window_p = frame_window_p;
bidi_it->nchars = -1; /* to be computed in bidi_resolve_explicit_1 */
bidi_it->first_elt = 1;
bidi_set_paragraph_end (bidi_it);
......@@ -996,7 +1000,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
display string, treat the entire run of covered characters as
a single character u+FFFC. */
curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos,
&bidi_it->disp_pos,
&bidi_it->disp_pos, bidi_it->frame_window_p,
&bidi_it->ch_len, &bidi_it->nchars);
}
bidi_it->ch = curchar;
......@@ -1674,11 +1678,13 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
EMACS_INT disp_pos = bidi_it->disp_pos;
EMACS_INT nc = bidi_it->nchars;
bidi_type_t chtype;
int fwp = bidi_it->frame_window_p;
if (bidi_it->nchars <= 0)
abort ();
do {
ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &clen, &nc);
ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, fwp,
&clen, &nc);
if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */)
chtype = NEUTRAL_B;
else
......
......@@ -1847,6 +1847,7 @@ struct bidi_it {
int first_elt; /* if non-zero, examine current char first */
bidi_dir_t paragraph_dir; /* current paragraph direction */
int new_paragraph; /* if non-zero, we expect a new paragraph */
int frame_window_p; /* non-zero if displaying on a GUI frame */
EMACS_INT separator_limit; /* where paragraph separator should end */
EMACS_INT disp_pos; /* position of display string after ch */
};
......@@ -2945,7 +2946,7 @@ enum tool_bar_item_image
/* Defined in bidi.c */
extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *);
extern void bidi_init_it (EMACS_INT, EMACS_INT, int, struct bidi_it *);
extern void bidi_move_to_visually_next (struct bidi_it *);
extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
extern int bidi_mirror_char (int);
......@@ -3006,7 +3007,7 @@ extern void reseat_at_previous_visible_line_start (struct it *);
extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
struct font *, int, int *);
extern EMACS_INT compute_display_string_pos (EMACS_INT);
extern EMACS_INT compute_display_string_pos (EMACS_INT, int);
extern EMACS_INT compute_display_string_end (EMACS_INT);
#ifdef HAVE_WINDOW_SYSTEM
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment