diff options
| author | Eli Zaretskii | 2011-05-21 17:22:14 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-05-21 17:22:14 +0300 |
| commit | fc6f18ceeaae3c3eb4d68120899e16c2fc73ea86 (patch) | |
| tree | dbbc17ffa38f01c0fe0184605569c1051f6eec8d /src/bidi.c | |
| parent | 683a44f77c8c83febe1ab7ebe7fc32d26fc71bcd (diff) | |
| download | emacs-fc6f18ceeaae3c3eb4d68120899e16c2fc73ea86.tar.gz emacs-fc6f18ceeaae3c3eb4d68120899e16c2fc73ea86.zip | |
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.c | 22 |
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) | |||
| 581 | string. */ | 581 | string. */ |
| 582 | static INLINE int | 582 | static INLINE int |
| 583 | bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | 583 | bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, |
| 584 | EMACS_INT *ch_len, EMACS_INT *nchars) | 584 | int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars) |
| 585 | { | 585 | { |
| 586 | int ch; | 586 | int ch; |
| 587 | 587 | ||
| @@ -589,7 +589,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 589 | /* If we got past the last known position of display string, compute | 589 | /* If we got past the last known position of display string, compute |
| 590 | the position of the next one. That position could be at BYTEPOS. */ | 590 | the position of the next one. That position could be at BYTEPOS. */ |
| 591 | if (charpos < ZV && charpos > *disp_pos) | 591 | if (charpos < ZV && charpos > *disp_pos) |
| 592 | *disp_pos = compute_display_string_pos (charpos); | 592 | *disp_pos = compute_display_string_pos (charpos, frame_window_p); |
| 593 | 593 | ||
| 594 | /* Fetch the character at BYTEPOS. */ | 594 | /* Fetch the character at BYTEPOS. */ |
| 595 | if (bytepos >= ZV_BYTE) | 595 | if (bytepos >= ZV_BYTE) |
| @@ -625,7 +625,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 625 | /* If we just entered a run of characters covered by a display | 625 | /* If we just entered a run of characters covered by a display |
| 626 | string, compute the position of the next display string. */ | 626 | string, compute the position of the next display string. */ |
| 627 | if (charpos + *nchars <= ZV && charpos + *nchars > *disp_pos) | 627 | if (charpos + *nchars <= ZV && charpos + *nchars > *disp_pos) |
| 628 | *disp_pos = compute_display_string_pos (charpos + *nchars); | 628 | *disp_pos = compute_display_string_pos (charpos + *nchars, frame_window_p); |
| 629 | 629 | ||
| 630 | return ch; | 630 | return ch; |
| 631 | } | 631 | } |
| @@ -754,7 +754,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) | |||
| 754 | do { | 754 | do { |
| 755 | bytepos = pstartbyte; | 755 | bytepos = pstartbyte; |
| 756 | pos = BYTE_TO_CHAR (bytepos); | 756 | pos = BYTE_TO_CHAR (bytepos); |
| 757 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, &ch_len, &nchars); | 757 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, bidi_it->frame_window_p, |
| 758 | &ch_len, &nchars); | ||
| 758 | type = bidi_get_type (ch, NEUTRAL_DIR); | 759 | type = bidi_get_type (ch, NEUTRAL_DIR); |
| 759 | 760 | ||
| 760 | for (pos += nchars, bytepos += ch_len; | 761 | 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) | |||
| 778 | break; | 779 | break; |
| 779 | } | 780 | } |
| 780 | /* Fetch next character and advance to get past it. */ | 781 | /* Fetch next character and advance to get past it. */ |
| 781 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, &ch_len, &nchars); | 782 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, |
| 783 | bidi_it->frame_window_p, &ch_len, &nchars); | ||
| 782 | pos += nchars; | 784 | pos += nchars; |
| 783 | bytepos += ch_len; | 785 | bytepos += ch_len; |
| 784 | } | 786 | } |
| @@ -840,12 +842,14 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it) | |||
| 840 | 842 | ||
| 841 | /* Initialize the bidi iterator from buffer/string position CHARPOS. */ | 843 | /* Initialize the bidi iterator from buffer/string position CHARPOS. */ |
| 842 | void | 844 | void |
| 843 | bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it) | 845 | bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p, |
| 846 | struct bidi_it *bidi_it) | ||
| 844 | { | 847 | { |
| 845 | if (! bidi_initialized) | 848 | if (! bidi_initialized) |
| 846 | bidi_initialize (); | 849 | bidi_initialize (); |
| 847 | bidi_it->charpos = charpos; | 850 | bidi_it->charpos = charpos; |
| 848 | bidi_it->bytepos = bytepos; | 851 | bidi_it->bytepos = bytepos; |
| 852 | bidi_it->frame_window_p = frame_window_p; | ||
| 849 | bidi_it->nchars = -1; /* to be computed in bidi_resolve_explicit_1 */ | 853 | bidi_it->nchars = -1; /* to be computed in bidi_resolve_explicit_1 */ |
| 850 | bidi_it->first_elt = 1; | 854 | bidi_it->first_elt = 1; |
| 851 | bidi_set_paragraph_end (bidi_it); | 855 | bidi_set_paragraph_end (bidi_it); |
| @@ -996,7 +1000,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) | |||
| 996 | display string, treat the entire run of covered characters as | 1000 | display string, treat the entire run of covered characters as |
| 997 | a single character u+FFFC. */ | 1001 | a single character u+FFFC. */ |
| 998 | curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos, | 1002 | curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos, |
| 999 | &bidi_it->disp_pos, | 1003 | &bidi_it->disp_pos, bidi_it->frame_window_p, |
| 1000 | &bidi_it->ch_len, &bidi_it->nchars); | 1004 | &bidi_it->ch_len, &bidi_it->nchars); |
| 1001 | } | 1005 | } |
| 1002 | bidi_it->ch = curchar; | 1006 | bidi_it->ch = curchar; |
| @@ -1674,11 +1678,13 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 1674 | EMACS_INT disp_pos = bidi_it->disp_pos; | 1678 | EMACS_INT disp_pos = bidi_it->disp_pos; |
| 1675 | EMACS_INT nc = bidi_it->nchars; | 1679 | EMACS_INT nc = bidi_it->nchars; |
| 1676 | bidi_type_t chtype; | 1680 | bidi_type_t chtype; |
| 1681 | int fwp = bidi_it->frame_window_p; | ||
| 1677 | 1682 | ||
| 1678 | if (bidi_it->nchars <= 0) | 1683 | if (bidi_it->nchars <= 0) |
| 1679 | abort (); | 1684 | abort (); |
| 1680 | do { | 1685 | do { |
| 1681 | ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &clen, &nc); | 1686 | ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, fwp, |
| 1687 | &clen, &nc); | ||
| 1682 | if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */) | 1688 | if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */) |
| 1683 | chtype = NEUTRAL_B; | 1689 | chtype = NEUTRAL_B; |
| 1684 | else | 1690 | else |