Start of work on bidi Emacs 23/24.
bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
xdisp.c (set_iterator_to_next): Fix position setting after call
to bidi_get_next_char_visually.
bidi.c: Include stdio.h unconditionally. Fix and elaborate
commentary. Add Copyright blurb.
+2009-08-15 Eli Zaretskii <eliz@gnu.org>
+
+ * bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
+
+ * xdisp.c (set_iterator_to_next): Fix position setting after call
+ to bidi_get_next_char_visually.
+
2005-12-03 Eli Zaretskii <eliz@gnu.org>
* bidi.c: Include stdio.h unconditionally. Fix and elaborate
2004-03-04 Kenichi Handa <handa@m17n.org>
- The following changes are to support bidirectional text display.
+ The following changes are to support for bi-directional text
+ display.
* Makefile.in (obj): Include bidi.o.
(bidi.o): New target.
/* lastfile must follow all files
whose initialized data areas should be dumped as pure by dump-emacs. */
obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
- bidi.o \
- charset.o coding.o category.o ccl.o character.o chartab.o \
+ charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \
cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
emacs.o keyboard.o macros.o keymap.o sysdep.o \
buffer.o filelock.o insdel.o marker.o \
atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
$(config_h)
-bidi.o: bidi.c buffer.h character.h
+bidi.o: bidi.c buffer.h character.h dispextern.h
buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
$(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
bidi_dir_t bidi_overriding_paragraph_direction = NEUTRAL_DIR;
+/* FIXME: Unused? */
#define ASCII_BIDI_TYPE_SET(STR, TYPE) \
do { \
unsigned char *p; \
bidi_type_table = Fmake_char_table (Qnil, make_number (STRONG_L));
for (i = 0; i < sizeof bidi_type / sizeof bidi_type[0]; i++)
- char_table_set_range (bidi_type_table, bidi_type[i].from, bidi_type[i].to,
+ char_table_set_range (bidi_type_table, bidi_type[i].from,
+ bidi_type[i].to ? bidi_type[i].to : bidi_type[i].from,
make_number (bidi_type[i].type));
bidi_initialized = 1;
}
buffer_defaults.truncate_lines = Qnil;
buffer_defaults.word_wrap = Qnil;
buffer_defaults.ctl_arrow = Qt;
- buffer_defaults.enable_bidi_display = Qnil;
- buffer_defaults.orientation_reversed = Qnil;
+ buffer_defaults.bidi_display_reordering = Qnil;
+ buffer_defaults.direction_reversed = Qnil;
buffer_defaults.cursor_type = Qt;
buffer_defaults.extra_line_spacing = Qnil;
buffer_defaults.cursor_in_non_selected_windows = Qt;
XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx;
XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx;
XSETFASTINT (buffer_local_flags.category_table, idx); ++idx;
- XSETFASTINT (buffer_local_flags.enable_bidi_display, idx); ++idx;
- XSETFASTINT (buffer_local_flags.orientation_reversed, idx); ++idx;
+ XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx;
+ XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx;
XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx);
/* Make this one a permanent local. */
buffer_permanent_local_flags[idx++] = 1;
doc: /* Default value of `ctl-arrow' for buffers that do not override it.
This is the same as (default-value 'ctl-arrow). */);
- DEFVAR_LISP_NOPRO ("default-enable-bidi-display",
- &buffer_defaults.enable_bidi_display,
- doc: /* *Default value of `enable-bidi-display' for buffers not overriding it.
-This is the same as (default-value 'enable-bidi-display). */);
+ DEFVAR_LISP_NOPRO ("default-bidi-display-reordering",
+ &buffer_defaults.bidi_display_reordering,
+ doc: /* *Default value of `bidi-display-reordering' for buffers not overriding it.
+This is the same as (default-value 'bidi-display-reordering). */);
- DEFVAR_LISP_NOPRO ("default-orientation-reversed",
- &buffer_defaults.orientation_reversed,
- doc: /* *Default value of `orientation-reversed' for buffers that do not override it.
-This is the same as (default-value 'orientation-reversed). */);
+ DEFVAR_LISP_NOPRO ("default-direction-reversed",
+ &buffer_defaults.direction_reversed,
+ doc: /* Default value of `direction-reversed' for buffers that do not override it.
+This is the same as (default-value 'direction-reversed). */);
DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters",
&buffer_defaults.enable_multibyte_characters,
This variable is never applied to a way of decoding a file while reading it. */);
- DEFVAR_PER_BUFFER ("orientation-reversed",
- ¤t_buffer->orientation_reversed, Qnil,
- doc: /* Non-nil means set beginning of lines at the right end of the window.
-See also the variable `enable-bidi-display'. */);
+ DEFVAR_PER_BUFFER ("direction-reversed",
+ ¤t_buffer->direction_reversed, Qnil,
+ doc: /* Non-nil means set beginning of lines at the right edge of the window.
+See also the variable `bidi-display-reordering'. */);
- DEFVAR_PER_BUFFER ("enable-bidi-display",
- ¤t_buffer->enable_bidi_display, Qnil,
- doc: /*Non-nil means display bidi text in correct visual order.
-See also the variable `orientation-reversed'. */);
+ DEFVAR_PER_BUFFER ("bidi-display-reordering",
+ ¤t_buffer->bidi_display_reordering, Qnil,
+ doc: /*Non-nil means reorder bidirectional text for display in the visual order.
+See also the variable `direction-reversed'. */);
DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil,
doc: /* *Non-nil means do not display continuation lines.
Lisp_Object word_wrap;
/* Non-nil means display ctl chars with uparrow. */
Lisp_Object ctl_arrow;
- /* Non-nil means display bidi text in correct visual order. */
- Lisp_Object enable_bidi_display;
- /* Non-nil means set beginning of lines at the right end of windows. */
- Lisp_Object orientation_reversed;
+ /* Non-nil means reorder bidirectional text for display in the
+ visual order. */
+ Lisp_Object bidi_display_reordering;
+ /* Non-nil means set beginning of lines at the right edge of
+ windows. */
+ Lisp_Object direction_reversed;
/* Non-nil means do selective display;
see doc string in syms_of_buffer (buffer.c) for details. */
Lisp_Object selective_display;
/* Face of the right fringe glyph. */
unsigned right_user_fringe_face_id : FACE_ID_BITS;
- /* 1 means we need bidi processing. */
+ /* Non-zero means we need to reorder bidirectional text for display
+ in the visual order. */
int bidi_p;
- /* For iterating over bidi text. */
+ /* For iterating over bidirectional text. */
struct bidi_it bidi_it;
};
if (!display_completed || cursor_in_echo_area)
return 0;
- /* Give up if we need bidi display. */
- if (!NILP (XBUFFER (w->buffer)->enable_bidi_display))
+ /* Give up if we need to reorder bidirectional text. */
+ if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering))
return 0;
- /* Give up if the buffer's orientation is reversed. */
- if (!NILP (XBUFFER (w->buffer)->orientation_reversed))
+ /* Give up if the buffer's direction is reversed. */
+ if (!NILP (XBUFFER (w->buffer)->direction_reversed))
return 0;
/* Can't use direct output if highlighting a region. */
/* Are multibyte characters enabled in current_buffer? */
it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
- /* Do we need multibyte processing? */
- it->bidi_p = !NILP (current_buffer->enable_bidi_display);
+ /* Do we need to reorded bidirectional text? */
+ it->bidi_p = !NILP (current_buffer->bidi_display_reordering);
/* Non-zero if we should highlight the region. */
highlight_region_p
if (it->bidi_p)
{
+ /* FIXME: L2R below is just for easyness of testing, as we
+ currently support only left-to-right paragraphs. The value
+ 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);
bidi_get_next_char_visually (&it->bidi_it);
else
{
bidi_get_next_char_visually (&it->bidi_it);
- IT_BYTEPOS (*it) = it->bidi_it.charpos;
- IT_CHARPOS (*it) = it->bidi_it.bytepos;
+ IT_BYTEPOS (*it) = it->bidi_it.bytepos;
+ IT_CHARPOS (*it) = it->bidi_it.charpos;
}
xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));
}