1 2010-01-09 Eli Zaretskii <eliz@gnu.org>
3 * xdisp.c (handle_stop_backwards): Add a prototype.
4 (reseat): call handle_stop_backwards to recompute prev_stop and
5 base_level_stop for the new position. Solves the crash when
8 2010-01-02 Eli Zaretskii <eliz@gnu.org>
10 * .gdbinit (pitx): Display some bidi information about the
13 * dispextern.h (BIDI_AT_BASE_LEVEL): Enclose definition in
16 * xdisp.c (handle_stop_backwards): Save and restore it->current
17 and it->position, instead of expecting the caller to do that.
18 (next_element_from_buffer): When moving across stop_charpos,
19 record it in prev_stop. When IT_CHARPOS backs up, call
20 handle_stop_backwards only if above the base embedding level.
21 This solves the crash while displaying etc/HELLO in bidi mode.
23 2009-12-26 Eli Zaretskii <eliz@gnu.org>
25 * xdisp.c (handle_stop_backwards): Call compute_stop_pos in the
26 loop, instead of calling handle_stop. Call handle_stop only once,
28 (next_element_from_buffer): Don't call handle_stop_backwards if at
29 stop position. If base_level_stop is zero, set it to 1.
31 * term.c (append_glyph): Fill resolved_level and bidi_type slots
32 of struct glyph for unidirectional display.
34 * xdisp.c (set_cursor_from_row): Handle zero-width characters.
36 * bidi.c (bidi_mirror_char): More efficient code (suggested by
37 Ehud Karni <ehud@unix.mvs.co.il>). Don't even try to mirror
40 2009-12-19 Eli Zaretskii <eliz@gnu.org>
42 * buffer.c (Fbuffer_swap_text): Swap the values of
43 bidi_display_reordering and bidi_paragraph_direction.
45 * bidi.c (bidi_resolve_weak): Fix nesting of conditions for Wn
46 processing. Move W3 after W1 and W2. Simplify W4 because it is
49 * .gdbinit (pbiditype): New command.
50 (pgx): Use it to display bidi level and type of the glyph.
52 2009-12-12 Eli Zaretskii <eliz@gnu.org>
54 * dispextern.h (struct it): New members prev_stop and
57 * xdisp.c (handle_stop_backwards): New function.
58 (next_element_from_buffer): Handle the situation where we
59 overstepped stop_charpos due to non-linearity of the bidi
60 iteration. Likewise for when we back up beyond the previous
62 (reseat_1, pop_it, push_it): Set prev_stop and base_level_stop.
64 * dispextern.h (BIDI_AT_BASE_LEVEL): New macro.
66 * bidi.c (bidi_copy_it): Fix compiler warning due to cast of a
67 pointer to `int'. Don't preserve the first_elt member, as it is
68 no longer copied, because its position in the structure was
71 * dispextern.h (struct bidi_it): Move first_elt, new_paragraph,
72 separator_limit, and paragraph_dir to after bidi_stack. Add a
73 note that anything beyond the level stack is not preserved when
74 the bidi iterator state is copied/saved.
76 2009-11-21 Eli Zaretskii <eliz@gnu.org>
78 * xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
79 lines when integer values of `cursor' property is used on display
82 2009-11-14 Eli Zaretskii <eliz@gnu.org>
84 * xdisp.c (init_iterator, text_outside_line_unchanged_p)
85 (try_window_id): Rename paragraph_direction to
86 bidi_paragraph_direction.
87 (set_cursor_from_row): Handle integer values of `cursor' property
90 * buffer.c (init_buffer_once, syms_of_buffer): Rename
91 paragraph_direction to bidi_paragraph_direction.
93 * buffer.h (struct buffer): Rename paragraph_direction to
94 bidi_paragraph_direction.
96 2009-11-07 Eli Zaretskii <eliz@gnu.org>
98 * bidi.c (bidi_paragraph_init): Don't overstep end of buffer.
99 Treat end of buffer as a NEUTRAL_B character.
100 (bidi_resolve_explicit): Don't special-case ZV when bidi_it->type
101 is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the
104 2009-10-31 Eli Zaretskii <eliz@gnu.org>
106 * xdisp.c (display_line): Always extend reversed_p rows to the end
108 (set_cursor_from_row): In R2L rows that don't display text, put
109 the cursor on the rightmost glyph.
111 2009-10-24 Eli Zaretskii <eliz@gnu.org>
113 * xdisp.c (set_cursor_from_row): Fix off-by-one error when
114 skipping over non-character glyphs at end of a reversed row.
116 * dispextern.h (struct glyph): The `resolved_level' member needs
117 only 5 bits, not 6. The `bidi_type' member needs only 3 bits.
118 (bidi_type_t): Rearrange so that types that can appear in the
119 resolved type are at the beginning and have values less than 8.
121 2009-10-23 Eli Zaretskii <eliz@gnu.org>
123 * bidi.c: Include setjmp.h.
125 2009-10-17 Eli Zaretskii <eliz@gnu.org>
127 * dispextern.h (struct glyph): New members resolved_level and
130 * xdisp.c (append_glyph, append_composite_glyph)
131 (produce_image_glyph, append_stretch_glyph): Set them.
133 * term.c (append_glyph): Ditto.
135 * xdisp.c (display_line, next_element_from_buffer): Set the glyph
136 row's reversed_p flag if the paragraph base direction is odd.
137 (extend_face_to_end_of_line): Don't reverse the glyphs here.
139 * term.c (append_glyph): Reverse glyphs here.
141 * bidi.c (bidi_get_next_char_visually): Don't exit early when at
143 (bidi_paragraph_init): Don't step over a newline if at BEGV.
145 2009-10-16 Eli Zaretskii <eliz@gnu.org>
147 * bidi.c (bidi_paragraph_init): Handle empty buffers.
149 2009-10-10 Eli Zaretskii <eliz@gnu.org>
151 * xdisp.c (set_cursor_from_row): Skip over glyphs near end of row
152 with integer OBJECT even if their CHARPOS is zero.
154 * bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH.
155 Abort if someone tries to add a cached state whose position is not
156 the immediate successor to that of the last cached state.
157 (bidi_paragraph_init): Don't bail out too early after a reseat.
159 2009-10-09 Eli Zaretskii <eliz@gnu.org>
161 * xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable
162 optimizations if we are reordering bidirectional text and the
163 paragraph direction can be affected by the change.
165 2009-10-08 Eli Zaretskii <eliz@gnu.org>
167 * xdisp.c (string_buffer_position_lim): New function.
168 (string_buffer_position): Most of code moved to
169 string_buffer_position_lim. Last argument and return value are
170 now EMACS_INT; all callers changed.
171 (set_cursor_from_row): Rewritten to support bidirectional text and
174 dispextern.h <string_buffer_position>: Update prototype.
176 2009-10-07 Eli Zaretskii <eliz@gnu.org>
178 * bidi.c (bidi_paragraph_init): Fix initialization of POS.
180 * dispextern.h (struct glyph_row): New member reversed_p.
182 2009-10-06 Eli Zaretskii <eliz@gnu.org>
184 * buffer.c (syms_of_buffer): Remove DEFVAR_LISP_NOPRO for
185 default-direction-reversed, default-bidi-display-reordering, and
186 default-paragraph-direction.
188 2009-10-05 Eli Zaretskii <eliz@gnu.org>
190 * buffer.h (struct buffer): New member paragraph_direction.
191 * buffer.c (init_buffer_once): Initialize it.
192 (syms_of_buffer): Declare Lisp variables
193 default-paragraph-direction and paragraph-direction.
195 * dispextern.h (struct it): New member paragraph_embedding.
196 * xdisp.c (init_iterator): Initialize it from the buffer's value
197 of paragraph-direction.
198 <Qright_to_left, Qleft_to_right>: New variables.
199 (syms_of_xdisp): Initialize and staticpro them.
200 (set_iterator_to_next, next_element_from_buffer): Use the value of
201 paragraph_embedding to determine the paragraph direction.
203 * bidi.c (bidi_line_init): Fix second argument to
205 (bidi_init_it): Initialize paragraph_dir to NEUTRAL_DIR.
206 (bidi_get_next_char_visually): Record the last character of the
207 separator in separator_limit, not the character after that.
208 (bidi_find_paragraph_start): Accept character and byte positions
209 instead of the whole iterator stricture. All callers changed.
211 2009-10-04 Eli Zaretskii <eliz@gnu.org>
213 * bidi.c (bidi_at_paragraph_end): Check for paragraph-start if
214 paragraph-separate failed to match. Return the length of the
216 (bidi_line_init): New function.
217 (bidi_paragraph_init): Use bidi_line_init. Do nothing if in the
218 middle of a paragraph-separate sequence. Don't override existing
219 paragraph direction if no strong characters found in this
220 paragraph. Set separator_limit according to what
221 bidi_at_paragraph_end returns. Reset new_paragraph flag when a
222 new paragraph is found.
223 (bidi_init_it): Reset separator_limit.
225 * dispextern.h (struct bidi_it): New member separator_limit.
227 * bidi.c (bidi_find_paragraph_start): Return the byte position of
228 the paragraph beginning.
230 * xdisp.c (set_iterator_to_next): Call bidi_paragraph_init if the
231 new_paragraph flag is set in the bidi iterator.
233 * bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): Use
234 the buffer-local value of paragraph-start and paragraph-separate.
236 2009-10-03 Eli Zaretskii <eliz@gnu.org>
238 * bidi.c (bidi_set_paragraph_end): Don't set the new_paragraph
239 flag in the iterator.
240 (bidi_init_it): Set the new_paragraph flag.
241 (bidi_at_paragraph_end): Arguments are now character and byte
242 position of the next character. All callers changed.
243 (bidi_resolve_explicit): Don't call bidi_at_paragraph_end, and
244 don't behave as if at paragraph end if it returns true.
245 (bidi_get_next_char_visually): Don't call bidi_paragraph_init if
246 new_paragraph flags is set. Set new_paragraph flag when at end of
248 <fallback_paragraph_start_re, fallback_paragraph_separate_re>: New
250 <Qparagraph_start, Qparagraph_separate>: New variables.
251 (bidi_initialize): Initialize and staticpro them.
253 * dispextern.h <struct bidi_it>: New element paragraph_dir. Make
254 positional elements EMACS_INT.
256 * bidi.c <bidi_overriding_paragraph_direction>: Delete.
258 2009-09-28 Eli Zaretskii <eliz@gnu.org>
260 * bidi.c (bidi_init_it): Initialize charpos, bytepos, and
261 first_elt before calling bidi_set_paragraph_end.
262 (bidi_resolve_explicit): Don't call bidi_set_paragraph_end at
264 (bidi_at_paragraph_end): Don't set new_paragraph flag at EOB.
265 (bidi_get_type): Accept an additional argument OVERRIDE, per UAX#9
266 "Explicit Overrides". All callers changed.
268 2009-09-27 Eli Zaretskii <eliz@gnu.org>
270 * xdisp.c (next_element_from_buffer): If called not at line
271 beginning, start bidi iteration from line beginning.
273 * bidi.c (bidi_paragraph_init): Use
274 bidi_overriding_paragraph_direction instead of a literal zero.
275 (bidi_initialize): Fix some character types, per Unicode 5.x.
276 (bidi_get_type): Abort if called with invalid character code.
278 * dispextern.h: Add prototype of bidi_mirror_char.
280 * xdisp.c (get_next_display_element): Mirror characters whose
281 resolved type is STRONG_R.
283 2009-09-26 Eli Zaretskii <eliz@gnu.org>
285 * bidi.c (bidi_paragraph_init): Don't set bidi_it->ch_len. Abort
286 if called not at beginning of a new paragraph.
287 (bidi_get_next_char_visually): Prepare and use a sentinel iterator
288 state when first_elt flag is set.
290 * dispextern.h (struct bidi_it): New struct member first_elt.
292 * bidi.c (bidi_init_it): Initialize bidi_it->first_elt.
293 (bidi_copy_it): Don't copy the first_elt flag.
295 * xdisp.c (reseat_1): Initialize bidi_it.first_elt. Move bidi
296 scan start code from here...
297 (next_element_from_buffer): ...to here. Use bidi_it.first_elt
300 2009-09-20 Eli Zaretskii <eliz@gnu.org>
302 * xdisp.c (reseat_1): Handle position < BEGV.
304 * bidi.c (bidi_paragraph_init): Set bidi_it->ch_len. Handle ZV.
305 (bidi_init_it): Don't initialize bidi_it->ch_len.
306 (bidi_resolve_explicit_1): Abort if bidi_it->ch_len was not
308 (bidi_at_paragraph_end, bidi_resolve_explicit_1)
309 (bidi_resolve_weak, bidi_level_of_next_char): Handle bytepos at
311 (bidi_resolve_explicit_1): Handle position < BEGV.
313 2009-09-19 Eli Zaretskii <eliz@gnu.org>
315 * xdisp.c (init_iterator): Call bidi_init_it. Set
316 bidi_it->bytepos if buffer position specified.
317 (reseat_1): Don't call bidi_init_it. Call bidi_paragraph_init
318 instead. Move back to preceding character before the call to
319 bidi_get_next_char_visually.
321 * bidi.c: Remove all STANDALONE parts.
322 (bidi_init_it): Init bidi_it->charpos and bidi_it->bytepos to -1.
323 Don't call bidi_paragraph_init. Change arguments.
324 (bidi_paragraph_init): Remove code for negative pos.
326 * dispextern.h <bidi_it>: Rename orig_type to type_after_w1 and
327 pristine_type to orig_type.
329 2009-09-12 Eli Zaretskii <eliz@gnu.org>
331 * dispnew.c (direct_output_for_insert): Give up if we are
332 reordering bidirectional text.
334 * dispextern.h (IT_STACK_SIZE): Enlarge to 5.
336 * xdisp.c (display_line): Set row->end and it->start for the next
337 row to the next character in logical order. If we are reordering
338 bidi text, push and pop the iterator before and after momentarily
339 iterating in logical order.
341 2009-09-11 Eli Zaretskii <eliz@gnu.org>
343 Note: The following changes were undone on 2009-09-12.
345 * xdisp.c (set_iterator_to_next, reseat, reseat_1)
346 (reseat_at_next_visible_line_start): Accept additional argument
347 force_logical_p; all callers changed. If force_logical_p is
348 non-zero, force iteration in buffer's logical order even in bidi
351 * dispnew.c (direct_output_for_insert): Call set_iterator_to_next
352 with additional argument zero.
354 * dispextern.h (set_iterator_to_next): Now accepts an additional
357 2009-08-29 Eli Zaretskii <eliz@gnu.org>
359 * xdisp.c (set_cursor_from_row): Don't assume glyph->charpos
361 (try_window_reusing_current_matrix): Don't assume glyph->charpos
364 2009-08-28 Eli Zaretskii <eliz@gnu.org>
366 * bidi.c <bidi_overriding_paragraph_direction>: Default to L2R,
369 2009-08-22 Eli Zaretskii <eliz@gnu.org>
371 * bidi.c (bidi_initialize): staticpro bidi_char_table.
372 (bidi_check_type): New function.
373 (bidi_cache_iterator_state, bidi_remember_char)
374 (bidi_resolve_explicit_1, bidi_resolve_explicit)
375 (bidi_resolve_weak, bidi_resolve_neutral)
376 (bidi_level_of_next_char): Use it to validate the bidi type
377 assigned to the iterator.
379 2009-08-15 Eli Zaretskii <eliz@gnu.org>
381 * bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
383 * xdisp.c (set_iterator_to_next): Fix position setting after call
384 to bidi_get_next_char_visually.
386 2005-12-03 Eli Zaretskii <eliz@gnu.org>
388 * bidi.c: Include stdio.h unconditionally. Fix and elaborate
389 commentary. Add Copyright blurb.
391 2004-03-08 Kenichi Handa <handa@m17n.org>
393 * xdisp.c (reseat_1): Call bidi_init_it with a previous position.
395 * bidi.c (bidi_init_it): Set bidi_it->ch_len even if POS > 0.
397 2004-03-04 Kenichi Handa <handa@m17n.org>
399 The following changes are to support bidirectional text display.
401 * Makefile.in (obj): Include bidi.o.
402 (bidi.o): New target.
406 * buffer.h (struct buffer): New member bidi_display_reordering.
408 * buffer.c (init_buffer_once): Initialize bidi_display_reordering.
409 (syms_of_buffer): Declarations of Lisp variables
410 default-bidi-display-reordering and bidi-display-reordering.
412 * dispextern.h (BIDI_MAXLEVEL): New macro.
413 (bidi_type_t, bidi_dir_t): New types.
414 (bidi_saved_info, bidi_stack, bidi_it): New structs.
415 (struct it): New members bidi_p and bidi_it.
416 (bidi_init_it): Extern it.
417 (bidi_get_next_char_visually): Extern it.
419 * dispnew.c (direct_output_forward_char): Give up if we need bidi
420 processing or buffer's direction is right-to-left.
422 * xdisp.c (init_iterator): Initialize it->bidi_p.
423 (reseat_1): Cal bidi_init_it and bidi_get_next_char_visually if
425 (set_iterator_to_next): Cal bidi_get_next_char_visually if
431 ;; add-log-time-zone-rule: t
434 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
436 This file is part of GNU Emacs.
438 GNU Emacs is free software: you can redistribute it and/or modify
439 it under the terms of the GNU General Public License as published by
440 the Free Software Foundation, either version 3 of the License, or
441 (at your option) any later version.
443 GNU Emacs is distributed in the hope that it will be useful,
444 but WITHOUT ANY WARRANTY; without even the implied warranty of
445 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
446 GNU General Public License for more details.
448 You should have received a copy of the GNU General Public License
449 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.