1 2009-12-26 Eli Zaretskii <eliz@gnu.org>
3 * xdisp.c (handle_stop_backwards): Call compute_stop_pos in the
4 loop, instead of calling handle_stop. Call handle_stop only once,
6 (next_element_from_buffer): Don't call handle_stop_backwards if at
7 stop position. If base_level_stop is zero, set it to 1.
9 * term.c (append_glyph): Fill resolved_level and bidi_type slots
10 of struct glyph for unidirectional display.
12 * xdisp.c (set_cursor_from_row): Handle zero-width characters.
14 * bidi.c (bidi_mirror_char): More efficient code (suggested by
15 Ehud Karni <ehud@unix.mvs.co.il>). Don't even try to mirror
18 2009-12-19 Eli Zaretskii <eliz@gnu.org>
20 * buffer.c (Fbuffer_swap_text): Swap the values of
21 bidi_display_reordering and bidi_paragraph_direction.
23 * bidi.c (bidi_resolve_weak): Fix nesting of conditions for Wn
24 processing. Move W3 after W1 and W2. Simplify W4 because it is
27 * .gdbinit (pbiditype): New command.
28 (pgx): Use it to display bidi level and type of the glyph.
30 2009-12-12 Eli Zaretskii <eliz@gnu.org>
32 * dispextern.h (struct it): New members prev_stop and
35 * xdisp.c (handle_stop_backwards): New function.
36 (next_element_from_buffer): Handle the situation where we
37 overstepped stop_charpos due to non-linearity of the bidi
38 iteration. Likewise for when we back up beyond the previous
40 (reseat_1, pop_it, push_it): Set prev_stop and base_level_stop.
42 * dispextern.h (BIDI_AT_BASE_LEVEL): New macro.
44 * bidi.c (bidi_copy_it): Fix compiler warning due to cast of a
45 pointer to `int'. Don't preserve the first_elt member, as it is
46 no longer copied, because its position in the structure was
49 * dispextern.h (struct bidi_it): Move first_elt, new_paragraph,
50 separator_limit, and paragraph_dir to after bidi_stack. Add a
51 note that anything beyond the level stack is not preserved when
52 the bidi iterator state is copied/saved.
54 2009-11-21 Eli Zaretskii <eliz@gnu.org>
56 * xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
57 lines when integer values of `cursor' property is used on display
60 2009-11-14 Eli Zaretskii <eliz@gnu.org>
62 * xdisp.c (init_iterator, text_outside_line_unchanged_p)
63 (try_window_id): Rename paragraph_direction to
64 bidi_paragraph_direction.
65 (set_cursor_from_row): Handle integer values of `cursor' property
68 * buffer.c (init_buffer_once, syms_of_buffer): Rename
69 paragraph_direction to bidi_paragraph_direction.
71 * buffer.h (struct buffer): Rename paragraph_direction to
72 bidi_paragraph_direction.
74 2009-11-07 Eli Zaretskii <eliz@gnu.org>
76 * bidi.c (bidi_paragraph_init): Don't overstep end of buffer.
77 Treat end of buffer as a NEUTRAL_B character.
78 (bidi_resolve_explicit): Don't special-case ZV when bidi_it->type
79 is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the
82 2009-10-31 Eli Zaretskii <eliz@gnu.org>
84 * xdisp.c (display_line): Always extend reversed_p rows to the end
86 (set_cursor_from_row): In R2L rows that don't display text, put
87 the cursor on the rightmost glyph.
89 2009-10-24 Eli Zaretskii <eliz@gnu.org>
91 * xdisp.c (set_cursor_from_row): Fix off-by-one error when
92 skipping over non-character glyphs at end of a reversed row.
94 * dispextern.h (struct glyph): The `resolved_level' member needs
95 only 5 bits, not 6. The `bidi_type' member needs only 3 bits.
96 (bidi_type_t): Rearrange so that types that can appear in the
97 resolved type are at the beginning and have values less than 8.
99 2009-10-23 Eli Zaretskii <eliz@gnu.org>
101 * bidi.c: Include setjmp.h.
103 2009-10-17 Eli Zaretskii <eliz@gnu.org>
105 * dispextern.h (struct glyph): New members resolved_level and
108 * xdisp.c (append_glyph, append_composite_glyph)
109 (produce_image_glyph, append_stretch_glyph): Set them.
111 * term.c (append_glyph): Ditto.
113 * xdisp.c (display_line, next_element_from_buffer): Set the glyph
114 row's reversed_p flag if the paragraph base direction is odd.
115 (extend_face_to_end_of_line): Don't reverse the glyphs here.
117 * term.c (append_glyph): Reverse glyphs here.
119 * bidi.c (bidi_get_next_char_visually): Don't exit early when at
121 (bidi_paragraph_init): Don't step over a newline if at BEGV.
123 2009-10-16 Eli Zaretskii <eliz@gnu.org>
125 * bidi.c (bidi_paragraph_init): Handle empty buffers.
127 2009-10-10 Eli Zaretskii <eliz@gnu.org>
129 * xdisp.c (set_cursor_from_row): Skip over glyphs near end of row
130 with integer OBJECT even if their CHARPOS is zero.
132 * bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH.
133 Abort if someone tries to add a cached state whose position is not
134 the immediate successor to that of the last cached state.
135 (bidi_paragraph_init): Don't bail out too early after a reseat.
137 2009-10-09 Eli Zaretskii <eliz@gnu.org>
139 * xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable
140 optimizations if we are reordering bidirectional text and the
141 paragraph direction can be affected by the change.
143 2009-10-08 Eli Zaretskii <eliz@gnu.org>
145 * xdisp.c (string_buffer_position_lim): New function.
146 (string_buffer_position): Most of code moved to
147 string_buffer_position_lim. Last argument and return value are
148 now EMACS_INT; all callers changed.
149 (set_cursor_from_row): Rewritten to support bidirectional text and
152 dispextern.h <string_buffer_position>: Update prototype.
154 2009-10-07 Eli Zaretskii <eliz@gnu.org>
156 * bidi.c (bidi_paragraph_init): Fix initialization of POS.
158 * dispextern.h (struct glyph_row): New member reversed_p.
160 2009-10-06 Eli Zaretskii <eliz@gnu.org>
162 * buffer.c (syms_of_buffer): Remove DEFVAR_LISP_NOPRO for
163 default-direction-reversed, default-bidi-display-reordering, and
164 default-paragraph-direction.
166 2009-10-05 Eli Zaretskii <eliz@gnu.org>
168 * buffer.h (struct buffer): New member paragraph_direction.
169 * buffer.c (init_buffer_once): Initialize it.
170 (syms_of_buffer): Declare Lisp variables
171 default-paragraph-direction and paragraph-direction.
173 * dispextern.h (struct it): New member paragraph_embedding.
174 * xdisp.c (init_iterator): Initialize it from the buffer's value
175 of paragraph-direction.
176 <Qright_to_left, Qleft_to_right>: New variables.
177 (syms_of_xdisp): Initialize and staticpro them.
178 (set_iterator_to_next, next_element_from_buffer): Use the value of
179 paragraph_embedding to determine the paragraph direction.
181 * bidi.c (bidi_line_init): Fix second argument to
183 (bidi_init_it): Initialize paragraph_dir to NEUTRAL_DIR.
184 (bidi_get_next_char_visually): Record the last character of the
185 separator in separator_limit, not the character after that.
186 (bidi_find_paragraph_start): Accept character and byte positions
187 instead of the whole iterator stricture. All callers changed.
189 2009-10-04 Eli Zaretskii <eliz@gnu.org>
191 * bidi.c (bidi_at_paragraph_end): Check for paragraph-start if
192 paragraph-separate failed to match. Return the length of the
194 (bidi_line_init): New function.
195 (bidi_paragraph_init): Use bidi_line_init. Do nothing if in the
196 middle of a paragraph-separate sequence. Don't override existing
197 paragraph direction if no strong characters found in this
198 paragraph. Set separator_limit according to what
199 bidi_at_paragraph_end returns. Reset new_paragraph flag when a
200 new paragraph is found.
201 (bidi_init_it): Reset separator_limit.
203 * dispextern.h (struct bidi_it): New member separator_limit.
205 * bidi.c (bidi_find_paragraph_start): Return the byte position of
206 the paragraph beginning.
208 * xdisp.c (set_iterator_to_next): Call bidi_paragraph_init if the
209 new_paragraph flag is set in the bidi iterator.
211 * bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): Use
212 the buffer-local value of paragraph-start and paragraph-separate.
214 2009-10-03 Eli Zaretskii <eliz@gnu.org>
216 * bidi.c (bidi_set_paragraph_end): Don't set the new_paragraph
217 flag in the iterator.
218 (bidi_init_it): Set the new_paragraph flag.
219 (bidi_at_paragraph_end): Arguments are now character and byte
220 position of the next character. All callers changed.
221 (bidi_resolve_explicit): Don't call bidi_at_paragraph_end, and
222 don't behave as if at paragraph end if it returns true.
223 (bidi_get_next_char_visually): Don't call bidi_paragraph_init if
224 new_paragraph flags is set. Set new_paragraph flag when at end of
226 <fallback_paragraph_start_re, fallback_paragraph_separate_re>: New
228 <Qparagraph_start, Qparagraph_separate>: New variables.
229 (bidi_initialize): Initialize and staticpro them.
231 * dispextern.h <struct bidi_it>: New element paragraph_dir. Make
232 positional elements EMACS_INT.
234 * bidi.c <bidi_overriding_paragraph_direction>: Delete.
236 2009-09-28 Eli Zaretskii <eliz@gnu.org>
238 * bidi.c (bidi_init_it): Initialize charpos, bytepos, and
239 first_elt before calling bidi_set_paragraph_end.
240 (bidi_resolve_explicit): Don't call bidi_set_paragraph_end at
242 (bidi_at_paragraph_end): Don't set new_paragraph flag at EOB.
243 (bidi_get_type): Accept an additional argument OVERRIDE, per UAX#9
244 "Explicit Overrides". All callers changed.
246 2009-09-27 Eli Zaretskii <eliz@gnu.org>
248 * xdisp.c (next_element_from_buffer): If called not at line
249 beginning, start bidi iteration from line beginning.
251 * bidi.c (bidi_paragraph_init): Use
252 bidi_overriding_paragraph_direction instead of a literal zero.
253 (bidi_initialize): Fix some character types, per Unicode 5.x.
254 (bidi_get_type): Abort if called with invalid character code.
256 * dispextern.h: Add prototype of bidi_mirror_char.
258 * xdisp.c (get_next_display_element): Mirror characters whose
259 resolved type is STRONG_R.
261 2009-09-26 Eli Zaretskii <eliz@gnu.org>
263 * bidi.c (bidi_paragraph_init): Don't set bidi_it->ch_len. Abort
264 if called not at beginning of a new paragraph.
265 (bidi_get_next_char_visually): Prepare and use a sentinel iterator
266 state when first_elt flag is set.
268 * dispextern.h (struct bidi_it): New struct member first_elt.
270 * bidi.c (bidi_init_it): Initialize bidi_it->first_elt.
271 (bidi_copy_it): Don't copy the first_elt flag.
273 * xdisp.c (reseat_1): Initialize bidi_it.first_elt. Move bidi
274 scan start code from here...
275 (next_element_from_buffer): ...to here. Use bidi_it.first_elt
278 2009-09-20 Eli Zaretskii <eliz@gnu.org>
280 * xdisp.c (reseat_1): Handle position < BEGV.
282 * bidi.c (bidi_paragraph_init): Set bidi_it->ch_len. Handle ZV.
283 (bidi_init_it): Don't initialize bidi_it->ch_len.
284 (bidi_resolve_explicit_1): Abort if bidi_it->ch_len was not
286 (bidi_at_paragraph_end, bidi_resolve_explicit_1)
287 (bidi_resolve_weak, bidi_level_of_next_char): Handle bytepos at
289 (bidi_resolve_explicit_1): Handle position < BEGV.
291 2009-09-19 Eli Zaretskii <eliz@gnu.org>
293 * xdisp.c (init_iterator): Call bidi_init_it. Set
294 bidi_it->bytepos if buffer position specified.
295 (reseat_1): Don't call bidi_init_it. Call bidi_paragraph_init
296 instead. Move back to preceding character before the call to
297 bidi_get_next_char_visually.
299 * bidi.c: Remove all STANDALONE parts.
300 (bidi_init_it): Init bidi_it->charpos and bidi_it->bytepos to -1.
301 Don't call bidi_paragraph_init. Change arguments.
302 (bidi_paragraph_init): Remove code for negative pos.
304 * dispextern.h <bidi_it>: Rename orig_type to type_after_w1 and
305 pristine_type to orig_type.
307 2009-09-12 Eli Zaretskii <eliz@gnu.org>
309 * dispnew.c (direct_output_for_insert): Give up if we are
310 reordering bidirectional text.
312 * dispextern.h (IT_STACK_SIZE): Enlarge to 5.
314 * xdisp.c (display_line): Set row->end and it->start for the next
315 row to the next character in logical order. If we are reordering
316 bidi text, push and pop the iterator before and after momentarily
317 iterating in logical order.
319 2009-09-11 Eli Zaretskii <eliz@gnu.org>
321 Note: The following changes were undone on 2009-09-12.
323 * xdisp.c (set_iterator_to_next, reseat, reseat_1)
324 (reseat_at_next_visible_line_start): Accept additional argument
325 force_logical_p; all callers changed. If force_logical_p is
326 non-zero, force iteration in buffer's logical order even in bidi
329 * dispnew.c (direct_output_for_insert): Call set_iterator_to_next
330 with additional argument zero.
332 * dispextern.h (set_iterator_to_next): Now accepts an additional
335 2009-08-29 Eli Zaretskii <eliz@gnu.org>
337 * xdisp.c (set_cursor_from_row): Don't assume glyph->charpos
339 (try_window_reusing_current_matrix): Don't assume glyph->charpos
342 2009-08-28 Eli Zaretskii <eliz@gnu.org>
344 * bidi.c <bidi_overriding_paragraph_direction>: Default to L2R,
347 2009-08-22 Eli Zaretskii <eliz@gnu.org>
349 * bidi.c (bidi_initialize): staticpro bidi_char_table.
350 (bidi_check_type): New function.
351 (bidi_cache_iterator_state, bidi_remember_char)
352 (bidi_resolve_explicit_1, bidi_resolve_explicit)
353 (bidi_resolve_weak, bidi_resolve_neutral)
354 (bidi_level_of_next_char): Use it to validate the bidi type
355 assigned to the iterator.
357 2009-08-15 Eli Zaretskii <eliz@gnu.org>
359 * bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
361 * xdisp.c (set_iterator_to_next): Fix position setting after call
362 to bidi_get_next_char_visually.
364 2005-12-03 Eli Zaretskii <eliz@gnu.org>
366 * bidi.c: Include stdio.h unconditionally. Fix and elaborate
367 commentary. Add Copyright blurb.
369 2004-03-08 Kenichi Handa <handa@m17n.org>
371 * xdisp.c (reseat_1): Call bidi_init_it with a previous position.
373 * bidi.c (bidi_init_it): Set bidi_it->ch_len even if POS > 0.
375 2004-03-04 Kenichi Handa <handa@m17n.org>
377 The following changes are to support bidirectional text display.
379 * Makefile.in (obj): Include bidi.o.
380 (bidi.o): New target.
384 * buffer.h (struct buffer): New member bidi_display_reordering.
386 * buffer.c (init_buffer_once): Initialize bidi_display_reordering.
387 (syms_of_buffer): Declarations of Lisp variables
388 default-bidi-display-reordering and bidi-display-reordering.
390 * dispextern.h (BIDI_MAXLEVEL): New macro.
391 (bidi_type_t, bidi_dir_t): New types.
392 (bidi_saved_info, bidi_stack, bidi_it): New structs.
393 (struct it): New members bidi_p and bidi_it.
394 (bidi_init_it): Extern it.
395 (bidi_get_next_char_visually): Extern it.
397 * dispnew.c (direct_output_forward_char): Give up if we need bidi
398 processing or buffer's direction is right-to-left.
400 * xdisp.c (init_iterator): Initialize it->bidi_p.
401 (reseat_1): Cal bidi_init_it and bidi_get_next_char_visually if
403 (set_iterator_to_next): Cal bidi_get_next_char_visually if
409 ;; add-log-time-zone-rule: t
412 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
414 This file is part of GNU Emacs.
416 GNU Emacs is free software: you can redistribute it and/or modify
417 it under the terms of the GNU General Public License as published by
418 the Free Software Foundation, either version 3 of the License, or
419 (at your option) any later version.
421 GNU Emacs is distributed in the hope that it will be useful,
422 but WITHOUT ANY WARRANTY; without even the implied warranty of
423 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424 GNU General Public License for more details.
426 You should have received a copy of the GNU General Public License
427 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.