summaryrefslogtreecommitdiff
path: root/src/bidi.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2011-05-21 17:22:14 +0300
committerEli Zaretskii <eliz@gnu.org>2011-05-21 17:22:14 +0300
commitfc6f18ceeaae3c3eb4d68120899e16c2fc73ea86 (patch)
treedbbc17ffa38f01c0fe0184605569c1051f6eec8d /src/bidi.c
parent683a44f77c8c83febe1ab7ebe7fc32d26fc71bcd (diff)
downloademacs-fc6f18ceeaae3c3eb4d68120899e16c2fc73ea86.tar.gz
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.
Diffstat (limited to 'src/bidi.c')
-rw-r--r--src/bidi.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/bidi.c b/src/bidi.c
index 742224607e4..17cb1214c73 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -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