Commit 89d3374a authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Retrospective commit from 2009-09-19.

Begin work on bidi initialization and other cleanup.
Remove all STANDALONE code from bidi.c.

 xdisp.c (init_iterator): Call bidi_init_it.  Set
 bidi_it->bytepos if buffer position specified.
 (reseat_1): Don't call bidi_init_it.  Call bidi_paragraph_init
 instead.  Move back to preceding character before the call to
 bidi_get_next_char_visually.
 bidi.c: Remove all STANDALONE parts.
 (bidi_init_it): Init bidi_it->charpos and bidi_it->bytepos to -1.
 Don't call bidi_paragraph_init.  Change arguments.
 (bidi_paragraph_init): Remove code for negative pos.
 dispextern.h <bidi_it>: Rename orig_type to type_after_w1 and
 pristine_type to orig_type.
parent d8300a8a
2009-09-19 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (init_iterator): Call bidi_init_it. Set
bidi_it->bytepos if buffer position specified.
(reseat_1): Don't call bidi_init_it. Call bidi_paragraph_init
instead. Move back to preceding character before the call to
bidi_get_next_char_visually.
* bidi.c: Remove all STANDALONE parts.
(bidi_init_it): Init bidi_it->charpos and bidi_it->bytepos to -1.
Don't call bidi_paragraph_init. Change arguments.
(bidi_paragraph_init): Remove code for negative pos.
* dispextern.h <bidi_it>: Rename orig_type to type_after_w1 and
pristine_type to orig_type.
2009-09-12 Eli Zaretskii <eliz@gnu.org>
* dispnew.c (direct_output_for_insert): Give up if we are
......
This diff is collapsed.
......@@ -1736,9 +1736,9 @@ typedef enum { NEUTRAL_DIR, L2R, R2L } bidi_dir_t;
remember. */
struct bidi_saved_info {
int bytepos, charpos; /* character's buffer position */
bidi_type_t type; /* character bidi type */
bidi_type_t orig_type; /* original type of the character, after W1 */
bidi_type_t pristine_type; /* type as we found it in the buffer */
bidi_type_t type; /* character's resolved bidi type */
bidi_type_t type_after_w1; /* original type of the character, after W1 */
bidi_type_t orig_type; /* type as we found it in the buffer */
};
/* Data type for keeping track of saved embedding levels and override
......@@ -1754,9 +1754,10 @@ struct bidi_it {
int charpos;
int ch; /* the character itself */
int ch_len; /* the length of its multibyte sequence */
bidi_type_t type; /* type of this character */
bidi_type_t orig_type; /* original type, after overrides and W1 */
bidi_type_t pristine_type; /* original type, as found in the buffer */
bidi_type_t type; /* bidi type of this character, after
resolving weak and neutral types */
bidi_type_t type_after_w1; /* original type, after overrides and W1 */
bidi_type_t orig_type; /* original type, as found in the buffer */
int resolved_level; /* final resolved level of this character */
int invalid_levels; /* how many PDFs should we ignore */
int invalid_rl_levels; /* how many PDFs from RLE/RLO should ignore */
......@@ -2786,9 +2787,9 @@ extern EMACS_INT tool_bar_button_relief;
/* Defined in bidi.c */
extern void bidi_init_it P_ ((int pos, bidi_dir_t dir,
struct bidi_it *bidi_it));
extern void bidi_get_next_char_visually P_ ((struct bidi_it *bidi_it));
extern void bidi_init_it P_ ((int, int, struct bidi_it *));
extern void bidi_get_next_char_visually P_ ((struct bidi_it *));
extern void bidi_paragraph_init P_ ((bidi_dir_t, struct bidi_it *));
/* Defined in xdisp.c */
......
......@@ -2806,6 +2806,11 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
it->start_of_box_run_p = 1;
}
/* If we are to reorder bidirectional text, init the bidi
iterator. */
if (it->bidi_p)
bidi_init_it (charpos, bytepos, &it->bidi_it);
/* If a buffer position was specified, set the iterator there,
getting overlays and face properties from that position. */
if (charpos >= BUF_BEG (current_buffer))
......@@ -2816,7 +2821,11 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
/* Compute byte position if not specified. */
if (bytepos < charpos)
IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos);
{
IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos);
if (it->bidi_p)
it->bidi_it.bytepos = IT_BYTEPOS (*it);
}
else
IT_BYTEPOS (*it) = bytepos;
......@@ -5322,8 +5331,8 @@ back_to_previous_visible_line_start (it)
if (IT_CHARPOS (*it) <= BEGV)
break;
/* If selective > 0, then lines indented more than that values
are invisible. */
/* If selective > 0, then lines indented more than its value are
invisible. */
if (it->selective > 0
&& indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
(double) it->selective)) /* iftc */
......@@ -5525,11 +5534,22 @@ reseat_1 (it, pos, set_stop_p)
should be user-definable and/or come from some ``higher
protocol''. In the absence of any other guidance, the default
for this initialization should be NEUTRAL_DIR. */
bidi_init_it (pos.charpos - 1, L2R, &it->bidi_it);
it->bidi_it.charpos = CHARPOS (pos);
it->bidi_it.bytepos = BYTEPOS (pos);
bidi_paragraph_init (L2R, &it->bidi_it);
/* With bidi reordering, the first character to display might
not be the character at POS. We need to find the next
character in visual order starting from the preceding
character. */
if ((it->bidi_it.charpos = CHARPOS (pos) - 1) > 1)
{
it->bidi_it.bytepos = CHAR_TO_BYTE (CHARPOS (pos) - 1);
it->bidi_it.ch_len = CHAR_BYTES (CHARPOS (pos) - 1);
}
else
it->bidi_it.bytepos = 0;
bidi_get_next_char_visually (&it->bidi_it);
pos.charpos = it->bidi_it.charpos;
pos.bytepos = it->bidi_it.bytepos;
SET_TEXT_POS (pos, it->bidi_it.charpos, it->bidi_it.bytepos);
it->current.pos = it->position = pos;
}
......@@ -6693,9 +6713,9 @@ next_element_from_composition (it)
line on the display without producing glyphs.
OP should be a bit mask including some or all of these bits:
MOVE_TO_X: Stop on reaching x-position TO_X.
MOVE_TO_POS: Stop on reaching buffer or string position TO_CHARPOS.
Regardless of OP's value, stop in reaching the end of the display line.
MOVE_TO_X: Stop upon reaching x-position TO_X.
MOVE_TO_POS: Stop upon reaching buffer or string position TO_CHARPOS.
Regardless of OP's value, stop upon reaching the end of the display line.
TO_X is normally a value 0 <= TO_X <= IT->last_visible_x.
This means, in particular, that TO_X includes window's horizontal
......
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