Commit a1344e7d authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 0c22566f
2011-06-25 Eli Zaretskii <eliz@gnu.org>
* 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.
* bidi.c (bidi_cache_iterator_state): Fix a bug with testing
character positions against the cached range, when we use a
stacked cache.
* xdisp.c (push_it, pop_it): Save and restore it.
* dispextern.h (struct iterator_stack_entry): New member
paragraph_embedding.
* xdisp.c (handle_single_display_spec, next_overlay_string)
(get_overlay_strings_1, push_display_prop): Set up the bidi
iterator for displaying display or overlay strings.
......
......@@ -481,7 +481,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
if (idx > bidi_cache_start &&
(bidi_it->charpos > (bidi_cache[idx - 1].charpos
+ bidi_cache[idx - 1].nchars)
|| bidi_it->charpos < bidi_cache[0].charpos))
|| bidi_it->charpos < bidi_cache[bidi_cache_start].charpos))
{
bidi_cache_reset ();
idx = bidi_cache_start;
......
......@@ -2251,6 +2251,7 @@ struct it
Lisp_Object from_overlay;
enum glyph_row_area area;
enum it_method method;
bidi_dir_t paragraph_embedding;
unsigned multibyte_p : 1;
unsigned string_from_display_prop_p : 1;
unsigned display_ellipsis_p : 1;
......
......@@ -5255,6 +5255,7 @@ push_it (struct it *it, struct text_pos *position)
p->display_ellipsis_p = 0;
p->line_wrap = it->line_wrap;
p->bidi_p = it->bidi_p;
p->paragraph_embedding = it->paragraph_embedding;
++it->sp;
/* Save the state of the bidi iterator as well. */
......@@ -5360,6 +5361,7 @@ pop_it (struct it *it)
it->string_from_display_prop_p = p->string_from_display_prop_p;
it->line_wrap = p->line_wrap;
it->bidi_p = p->bidi_p;
it->paragraph_embedding = p->paragraph_embedding;
if (it->bidi_p)
{
bidi_pop_it (&it->bidi_it);
......@@ -6511,11 +6513,11 @@ set_iterator_to_next (struct it *it, int reseat_p)
case GET_FROM_C_STRING:
/* Current display element of IT is from a C string. */
if (!it->bidi_p
/* If the string position is beyond string_nchars, it means
/* If the string position is beyond string's end, it means
next_element_from_c_string is padding the string with
blanks, in which case we bypass the bidi iterator,
because it cannot deal with such virtual characters. */
|| IT_CHARPOS (*it) >= it->string_nchars)
|| IT_CHARPOS (*it) >= it->bidi_it.string.schars)
{
IT_BYTEPOS (*it) += it->len;
IT_CHARPOS (*it) += 1;
......@@ -6639,12 +6641,12 @@ set_iterator_to_next (struct it *it, int reseat_p)
else
{
if (!it->bidi_p
/* If the string position is beyond string_nchars, it
/* If the string position is beyond string's end, it
means next_element_from_string is padding the string
with blanks, in which case we bypass the bidi
iterator, because it cannot deal with such virtual
characters. */
|| IT_STRING_CHARPOS (*it) >= it->string_nchars)
|| IT_STRING_CHARPOS (*it) >= it->bidi_it.string.schars)
{
IT_STRING_BYTEPOS (*it) += it->len;
IT_STRING_CHARPOS (*it) += 1;
......@@ -6779,7 +6781,7 @@ static void
get_visually_first_element (struct it *it)
{
int string_p = STRINGP (it->string) || it->s;
EMACS_INT eob = (string_p ? it->string_nchars : ZV);
EMACS_INT eob = (string_p ? it->bidi_it.string.schars : ZV);
EMACS_INT bob = (string_p ? 0 : BEGV);
if (STRINGP (it->string))
......
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