aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2011-06-25 19:14:01 +0300
committerEli Zaretskii <[email protected]>2011-06-25 19:14:01 +0300
commita1344e7d125a094bf49460f1a356f98fa86a8f9f (patch)
tree25029f10879deb153584d3541e0aac6365231288 /src
parent0c22566f00ee467af8d41ef7dc9f18c3b66630c5 (diff)
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/ChangeLog14
-rw-r--r--src/bidi.c2
-rw-r--r--src/dispextern.h1
-rw-r--r--src/xdisp.c12
4 files changed, 23 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 083aaaaa4b..8d5275f970 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,19 @@
2011-06-25 Eli Zaretskii <[email protected]>
+ * 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.
diff --git a/src/bidi.c b/src/bidi.c
index b518dd4578..0cd8deb47c 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -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;
diff --git a/src/dispextern.h b/src/dispextern.h
index d5479c7a64..16fa3abdd1 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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;
diff --git a/src/xdisp.c b/src/xdisp.c
index dc9a62fc0b..3b93454747 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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))