Commit 6eec7596 authored by Eli Zaretskii's avatar Eli Zaretskii

Start fixing cursor motion around invisible text.

Hit a MAJOR design problem in pushing and popping bidi iterator state.

 src/xdisp.c (reseat_1): Call bidi_init_it to resync the bidi
 iterator with IT's position.
 (handle_stop, back_to_previous_visible_line_start, reseat_1):
 Reset the from_disp_prop_p flag.
 src/bidi.c (bidi_cache_search): Don't assume bidi_cache_last_idx is
 always valid if bidi_cache_idx is valid.
 (bidi_cache_find_level_change): xassert that bidi_cache_last_idx
 is valid if it's going to be used.
parent a2eaa31d
2011-07-02 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (reseat_1): Call bidi_init_it to resync the bidi
iterator with IT's position.
(handle_stop, back_to_previous_visible_line_start, reseat_1):
Reset the from_disp_prop_p flag.
* bidi.c (bidi_cache_search): Don't assume bidi_cache_last_idx is
always valid if bidi_cache_idx is valid.
(bidi_cache_find_level_change): xassert that bidi_cache_last_idx
is valid if it's going to be used.
* dispextern.h (struct iterator_stack_entry, struct it): New
member from_disp_prop_p.
......
......@@ -352,8 +352,10 @@ bidi_cache_search (EMACS_INT charpos, int level, int dir)
{
int i, i_start;
if (bidi_cache_idx)
if (bidi_cache_idx > bidi_cache_start)
{
if (bidi_cache_last_idx == -1)
bidi_cache_last_idx = bidi_cache_idx - 1;
if (charpos < bidi_cache[bidi_cache_last_idx].charpos)
{
dir = -1;
......@@ -418,6 +420,8 @@ bidi_cache_find_level_change (int level, int dir, int before)
int i = dir ? bidi_cache_last_idx : bidi_cache_idx - 1;
int incr = before ? 1 : 0;
xassert (!dir || bidi_cache_last_idx >= 0);
if (!dir)
dir = -1;
else if (!incr)
......
......@@ -2915,6 +2915,7 @@ handle_stop (struct it *it)
{
it->ignore_overlay_strings_at_pos_p = 1;
it->string_from_display_prop_p = 0;
it->from_disp_prop_p = 0;
handle_overlay_change_p = 0;
}
handled = HANDLED_RECOMPUTE_PROPS;
......@@ -5542,6 +5543,7 @@ back_to_previous_visible_line_start (struct it *it)
--IT_BYTEPOS (it2);
it2.sp = 0;
it2.string_from_display_prop_p = 0;
it2.from_disp_prop_p = 0;
if (handle_display_prop (&it2) == HANDLED_RETURN
&& !NILP (val = get_char_property_and_overlay
(make_number (pos), Qdisplay, Qnil, &overlay))
......@@ -5740,12 +5742,13 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
it->sp = 0;
it->string_from_display_prop_p = 0;
it->from_disp_prop_p = 0;
it->face_before_selective_p = 0;
if (it->bidi_p)
{
it->bidi_it.first_elt = 1;
bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f),
&it->bidi_it);
it->bidi_it.paragraph_dir = NEUTRAL_DIR;
it->bidi_it.disp_pos = -1;
it->bidi_it.string.s = NULL;
it->bidi_it.string.lstring = Qnil;
it->bidi_it.string.bufpos = 0;
......
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