diff options
| author | Eli Zaretskii | 2011-06-25 19:14:01 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-06-25 19:14:01 +0300 |
| commit | a1344e7d125a094bf49460f1a356f98fa86a8f9f (patch) | |
| tree | 25029f10879deb153584d3541e0aac6365231288 /src | |
| parent | 0c22566f00ee467af8d41ef7dc9f18c3b66630c5 (diff) | |
| download | emacs-a1344e7d125a094bf49460f1a356f98fa86a8f9f.tar.gz emacs-a1344e7d125a094bf49460f1a356f98fa86a8f9f.zip | |
Initial version of display/overlay strings is working.
src/xdisp.c (set_iterator_to_next, get_visually_first_element): Use
it->bidi_it.string.schars rather than it->string_nchars when
testing whether we're beyond string end, because string_nchars is
zero for strings that come from overlays and display properties.
src/bidi.c (bidi_cache_iterator_state): Fix a bug with testing
character positions against the cached range, when we use a
stacked cache.
src/dispextern.h (struct iterator_stack_entry): New member
paragraph_embedding.
src/xdisp.c (push_it, pop_it): Save and restore it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/bidi.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/xdisp.c | 12 |
4 files changed, 23 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 083aaaaa4bd..8d5275f9702 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,19 @@ | |||
| 1 | 2011-06-25 Eli Zaretskii <eliz@gnu.org> | 1 | 2011-06-25 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (set_iterator_to_next, get_visually_first_element): Use | ||
| 4 | it->bidi_it.string.schars rather than it->string_nchars when | ||
| 5 | testing whether we're beyond string end, because string_nchars is | ||
| 6 | zero for strings that come from overlays and display properties. | ||
| 7 | |||
| 8 | * bidi.c (bidi_cache_iterator_state): Fix a bug with testing | ||
| 9 | character positions against the cached range, when we use a | ||
| 10 | stacked cache. | ||
| 11 | |||
| 12 | * xdisp.c (push_it, pop_it): Save and restore it. | ||
| 13 | |||
| 14 | * dispextern.h (struct iterator_stack_entry): New member | ||
| 15 | paragraph_embedding. | ||
| 16 | |||
| 3 | * xdisp.c (handle_single_display_spec, next_overlay_string) | 17 | * xdisp.c (handle_single_display_spec, next_overlay_string) |
| 4 | (get_overlay_strings_1, push_display_prop): Set up the bidi | 18 | (get_overlay_strings_1, push_display_prop): Set up the bidi |
| 5 | iterator for displaying display or overlay strings. | 19 | iterator for displaying display or overlay strings. |
diff --git a/src/bidi.c b/src/bidi.c index b518dd45782..0cd8deb47c0 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -481,7 +481,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) | |||
| 481 | if (idx > bidi_cache_start && | 481 | if (idx > bidi_cache_start && |
| 482 | (bidi_it->charpos > (bidi_cache[idx - 1].charpos | 482 | (bidi_it->charpos > (bidi_cache[idx - 1].charpos |
| 483 | + bidi_cache[idx - 1].nchars) | 483 | + bidi_cache[idx - 1].nchars) |
| 484 | || bidi_it->charpos < bidi_cache[0].charpos)) | 484 | || bidi_it->charpos < bidi_cache[bidi_cache_start].charpos)) |
| 485 | { | 485 | { |
| 486 | bidi_cache_reset (); | 486 | bidi_cache_reset (); |
| 487 | idx = bidi_cache_start; | 487 | idx = bidi_cache_start; |
diff --git a/src/dispextern.h b/src/dispextern.h index d5479c7a64e..16fa3abdd19 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2251,6 +2251,7 @@ struct it | |||
| 2251 | Lisp_Object from_overlay; | 2251 | Lisp_Object from_overlay; |
| 2252 | enum glyph_row_area area; | 2252 | enum glyph_row_area area; |
| 2253 | enum it_method method; | 2253 | enum it_method method; |
| 2254 | bidi_dir_t paragraph_embedding; | ||
| 2254 | unsigned multibyte_p : 1; | 2255 | unsigned multibyte_p : 1; |
| 2255 | unsigned string_from_display_prop_p : 1; | 2256 | unsigned string_from_display_prop_p : 1; |
| 2256 | unsigned display_ellipsis_p : 1; | 2257 | unsigned display_ellipsis_p : 1; |
diff --git a/src/xdisp.c b/src/xdisp.c index dc9a62fc0b6..3b934547471 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5255,6 +5255,7 @@ push_it (struct it *it, struct text_pos *position) | |||
| 5255 | p->display_ellipsis_p = 0; | 5255 | p->display_ellipsis_p = 0; |
| 5256 | p->line_wrap = it->line_wrap; | 5256 | p->line_wrap = it->line_wrap; |
| 5257 | p->bidi_p = it->bidi_p; | 5257 | p->bidi_p = it->bidi_p; |
| 5258 | p->paragraph_embedding = it->paragraph_embedding; | ||
| 5258 | ++it->sp; | 5259 | ++it->sp; |
| 5259 | 5260 | ||
| 5260 | /* Save the state of the bidi iterator as well. */ | 5261 | /* Save the state of the bidi iterator as well. */ |
| @@ -5360,6 +5361,7 @@ pop_it (struct it *it) | |||
| 5360 | it->string_from_display_prop_p = p->string_from_display_prop_p; | 5361 | it->string_from_display_prop_p = p->string_from_display_prop_p; |
| 5361 | it->line_wrap = p->line_wrap; | 5362 | it->line_wrap = p->line_wrap; |
| 5362 | it->bidi_p = p->bidi_p; | 5363 | it->bidi_p = p->bidi_p; |
| 5364 | it->paragraph_embedding = p->paragraph_embedding; | ||
| 5363 | if (it->bidi_p) | 5365 | if (it->bidi_p) |
| 5364 | { | 5366 | { |
| 5365 | bidi_pop_it (&it->bidi_it); | 5367 | bidi_pop_it (&it->bidi_it); |
| @@ -6511,11 +6513,11 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6511 | case GET_FROM_C_STRING: | 6513 | case GET_FROM_C_STRING: |
| 6512 | /* Current display element of IT is from a C string. */ | 6514 | /* Current display element of IT is from a C string. */ |
| 6513 | if (!it->bidi_p | 6515 | if (!it->bidi_p |
| 6514 | /* If the string position is beyond string_nchars, it means | 6516 | /* If the string position is beyond string's end, it means |
| 6515 | next_element_from_c_string is padding the string with | 6517 | next_element_from_c_string is padding the string with |
| 6516 | blanks, in which case we bypass the bidi iterator, | 6518 | blanks, in which case we bypass the bidi iterator, |
| 6517 | because it cannot deal with such virtual characters. */ | 6519 | because it cannot deal with such virtual characters. */ |
| 6518 | || IT_CHARPOS (*it) >= it->string_nchars) | 6520 | || IT_CHARPOS (*it) >= it->bidi_it.string.schars) |
| 6519 | { | 6521 | { |
| 6520 | IT_BYTEPOS (*it) += it->len; | 6522 | IT_BYTEPOS (*it) += it->len; |
| 6521 | IT_CHARPOS (*it) += 1; | 6523 | IT_CHARPOS (*it) += 1; |
| @@ -6639,12 +6641,12 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6639 | else | 6641 | else |
| 6640 | { | 6642 | { |
| 6641 | if (!it->bidi_p | 6643 | if (!it->bidi_p |
| 6642 | /* If the string position is beyond string_nchars, it | 6644 | /* If the string position is beyond string's end, it |
| 6643 | means next_element_from_string is padding the string | 6645 | means next_element_from_string is padding the string |
| 6644 | with blanks, in which case we bypass the bidi | 6646 | with blanks, in which case we bypass the bidi |
| 6645 | iterator, because it cannot deal with such virtual | 6647 | iterator, because it cannot deal with such virtual |
| 6646 | characters. */ | 6648 | characters. */ |
| 6647 | || IT_STRING_CHARPOS (*it) >= it->string_nchars) | 6649 | || IT_STRING_CHARPOS (*it) >= it->bidi_it.string.schars) |
| 6648 | { | 6650 | { |
| 6649 | IT_STRING_BYTEPOS (*it) += it->len; | 6651 | IT_STRING_BYTEPOS (*it) += it->len; |
| 6650 | IT_STRING_CHARPOS (*it) += 1; | 6652 | IT_STRING_CHARPOS (*it) += 1; |
| @@ -6779,7 +6781,7 @@ static void | |||
| 6779 | get_visually_first_element (struct it *it) | 6781 | get_visually_first_element (struct it *it) |
| 6780 | { | 6782 | { |
| 6781 | int string_p = STRINGP (it->string) || it->s; | 6783 | int string_p = STRINGP (it->string) || it->s; |
| 6782 | EMACS_INT eob = (string_p ? it->string_nchars : ZV); | 6784 | EMACS_INT eob = (string_p ? it->bidi_it.string.schars : ZV); |
| 6783 | EMACS_INT bob = (string_p ? 0 : BEGV); | 6785 | EMACS_INT bob = (string_p ? 0 : BEGV); |
| 6784 | 6786 | ||
| 6785 | if (STRINGP (it->string)) | 6787 | if (STRINGP (it->string)) |