1 2010-01-25 Eli Zaretskii <eliz@gnu.org>
3 Clean up the mess with setting the glyph row reversed_p flag.
4 * dispnew.c (prepare_desired_row): Preserve the reversed_p flag.
6 * bidi.c (bidi_cache_find): Use bidi_copy_it instead of copying
7 the whole struct (which includes uninitialized parts).
8 (bidi_init_it): Don't initialize bidi_it->paragraph_dir.
10 * xdisp.c (display_line): Remove misplaced setting of
11 row->reversed_p flags. Copy the reversed_p flag to the next glyph
13 (next_element_from_buffer): Check bidi_it.paragraph_dir rather
14 than level_stack[0].level. Reset the reversed_p flag for non-R2L
17 Fix display of invisible text.
18 * xdisp.c (handle_invisible_prop): If we are `reseat'ed, init the
19 paragraph direction and set the `reversed_p' flag in the IT's
20 glyph row. Fix exit conditions of the loop that skips invisible
21 text. Update IT->prev_stop after skipping invisible text. Check
22 for additional overlays at IT->stop_charpos, not at start_pos.
24 2010-01-16 Eli Zaretskii <eliz@gnu.org>
26 * xdisp.c (handle_invisible_prop): Under bidi iteration, skip
27 invisible text using bidi_get_next_char_visually.
28 (handle_stop_backwards): Restore it->bidi_p, it->current and
29 it->position before calling handle_stop.
30 (next_element_from_buffer): Fix formatting.
32 2010-01-09 Eli Zaretskii <eliz@gnu.org>
34 * xdisp.c (handle_stop_backwards): Add a prototype.
35 (reseat): call handle_stop_backwards to recompute prev_stop and
36 base_level_stop for the new position. Solves the crash when
39 2010-01-02 Eli Zaretskii <eliz@gnu.org>
41 * .gdbinit (pitx): Display some bidi information about the
44 * dispextern.h (BIDI_AT_BASE_LEVEL): Enclose definition in
47 * xdisp.c (handle_stop_backwards): Save and restore it->current
48 and it->position, instead of expecting the caller to do that.
49 (next_element_from_buffer): When moving across stop_charpos,
50 record it in prev_stop. When IT_CHARPOS backs up, call
51 handle_stop_backwards only if above the base embedding level.
52 This solves the crash while displaying etc/HELLO in bidi mode.
54 2009-12-26 Eli Zaretskii <eliz@gnu.org>
56 * xdisp.c (handle_stop_backwards): Call compute_stop_pos in the
57 loop, instead of calling handle_stop. Call handle_stop only once,
59 (next_element_from_buffer): Don't call handle_stop_backwards if at
60 stop position. If base_level_stop is zero, set it to 1.
62 * term.c (append_glyph): Fill resolved_level and bidi_type slots
63 of struct glyph for unidirectional display.
65 * xdisp.c (set_cursor_from_row): Handle zero-width characters.
67 * bidi.c (bidi_mirror_char): More efficient code (suggested by
68 Ehud Karni <ehud@unix.mvs.co.il>). Don't even try to mirror
71 2009-12-19 Eli Zaretskii <eliz@gnu.org>
73 * buffer.c (Fbuffer_swap_text): Swap the values of
74 bidi_display_reordering and bidi_paragraph_direction.
76 * bidi.c (bidi_resolve_weak): Fix nesting of conditions for Wn
77 processing. Move W3 after W1 and W2. Simplify W4 because it is
80 * .gdbinit (pbiditype): New command.
81 (pgx): Use it to display bidi level and type of the glyph.
83 2009-12-12 Eli Zaretskii <eliz@gnu.org>
85 * dispextern.h (struct it): New members prev_stop and
88 * xdisp.c (handle_stop_backwards): New function.
89 (next_element_from_buffer): Handle the situation where we
90 overstepped stop_charpos due to non-linearity of the bidi
91 iteration. Likewise for when we back up beyond the previous
93 (reseat_1, pop_it, push_it): Set prev_stop and base_level_stop.
95 * dispextern.h (BIDI_AT_BASE_LEVEL): New macro.
97 * bidi.c (bidi_copy_it): Fix compiler warning due to cast of a
98 pointer to `int'. Don't preserve the first_elt member, as it is
99 no longer copied, because its position in the structure was
102 * dispextern.h (struct bidi_it): Move first_elt, new_paragraph,
103 separator_limit, and paragraph_dir to after bidi_stack. Add a
104 note that anything beyond the level stack is not preserved when
105 the bidi iterator state is copied/saved.
107 2009-11-21 Eli Zaretskii <eliz@gnu.org>
109 * xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
110 lines when integer values of `cursor' property is used on display
113 2009-11-14 Eli Zaretskii <eliz@gnu.org>
115 * xdisp.c (init_iterator, text_outside_line_unchanged_p)
116 (try_window_id): Rename paragraph_direction to
117 bidi_paragraph_direction.
118 (set_cursor_from_row): Handle integer values of `cursor' property
121 * buffer.c (init_buffer_once, syms_of_buffer): Rename
122 paragraph_direction to bidi_paragraph_direction.
124 * buffer.h (struct buffer): Rename paragraph_direction to
125 bidi_paragraph_direction.
127 2009-11-07 Eli Zaretskii <eliz@gnu.org>
129 * bidi.c (bidi_paragraph_init): Don't overstep end of buffer.
130 Treat end of buffer as a NEUTRAL_B character.
131 (bidi_resolve_explicit): Don't special-case ZV when bidi_it->type
132 is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the
135 2009-10-31 Eli Zaretskii <eliz@gnu.org>
137 * xdisp.c (display_line): Always extend reversed_p rows to the end
139 (set_cursor_from_row): In R2L rows that don't display text, put
140 the cursor on the rightmost glyph.
142 2009-10-24 Eli Zaretskii <eliz@gnu.org>
144 * xdisp.c (set_cursor_from_row): Fix off-by-one error when
145 skipping over non-character glyphs at end of a reversed row.
147 * dispextern.h (struct glyph): The `resolved_level' member needs
148 only 5 bits, not 6. The `bidi_type' member needs only 3 bits.
149 (bidi_type_t): Rearrange so that types that can appear in the
150 resolved type are at the beginning and have values less than 8.
152 2009-10-23 Eli Zaretskii <eliz@gnu.org>
154 * bidi.c: Include setjmp.h.
156 2009-10-17 Eli Zaretskii <eliz@gnu.org>
158 * dispextern.h (struct glyph): New members resolved_level and
161 * xdisp.c (append_glyph, append_composite_glyph)
162 (produce_image_glyph, append_stretch_glyph): Set them.
164 * term.c (append_glyph): Ditto.
166 * xdisp.c (display_line, next_element_from_buffer): Set the glyph
167 row's reversed_p flag if the paragraph base direction is odd.
168 (extend_face_to_end_of_line): Don't reverse the glyphs here.
170 * term.c (append_glyph): Reverse glyphs here.
172 * bidi.c (bidi_get_next_char_visually): Don't exit early when at
174 (bidi_paragraph_init): Don't step over a newline if at BEGV.
176 2009-10-16 Eli Zaretskii <eliz@gnu.org>
178 * bidi.c (bidi_paragraph_init): Handle empty buffers.
180 2009-10-10 Eli Zaretskii <eliz@gnu.org>
182 * xdisp.c (set_cursor_from_row): Skip over glyphs near end of row
183 with integer OBJECT even if their CHARPOS is zero.
185 * bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH.
186 Abort if someone tries to add a cached state whose position is not
187 the immediate successor to that of the last cached state.
188 (bidi_paragraph_init): Don't bail out too early after a reseat.
190 2009-10-09 Eli Zaretskii <eliz@gnu.org>
192 * xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable
193 optimizations if we are reordering bidirectional text and the
194 paragraph direction can be affected by the change.
196 2009-10-08 Eli Zaretskii <eliz@gnu.org>
198 * xdisp.c (string_buffer_position_lim): New function.
199 (string_buffer_position): Most of code moved to
200 string_buffer_position_lim. Last argument and return value are
201 now EMACS_INT; all callers changed.
202 (set_cursor_from_row): Rewritten to support bidirectional text and
205 dispextern.h <string_buffer_position>: Update prototype.
207 2009-10-07 Eli Zaretskii <eliz@gnu.org>
209 * bidi.c (bidi_paragraph_init): Fix initialization of POS.
211 * dispextern.h (struct glyph_row): New member reversed_p.
213 2009-10-06 Eli Zaretskii <eliz@gnu.org>
215 * buffer.c (syms_of_buffer): Remove DEFVAR_LISP_NOPRO for
216 default-direction-reversed, default-bidi-display-reordering, and
217 default-paragraph-direction.
219 2009-10-05 Eli Zaretskii <eliz@gnu.org>
221 * buffer.h (struct buffer): New member paragraph_direction.
222 * buffer.c (init_buffer_once): Initialize it.
223 (syms_of_buffer): Declare Lisp variables
224 default-paragraph-direction and paragraph-direction.
226 * dispextern.h (struct it): New member paragraph_embedding.
227 * xdisp.c (init_iterator): Initialize it from the buffer's value
228 of paragraph-direction.
229 <Qright_to_left, Qleft_to_right>: New variables.
230 (syms_of_xdisp): Initialize and staticpro them.
231 (set_iterator_to_next, next_element_from_buffer): Use the value of
232 paragraph_embedding to determine the paragraph direction.
234 * bidi.c (bidi_line_init): Fix second argument to
236 (bidi_init_it): Initialize paragraph_dir to NEUTRAL_DIR.
237 (bidi_get_next_char_visually): Record the last character of the
238 separator in separator_limit, not the character after that.
239 (bidi_find_paragraph_start): Accept character and byte positions
240 instead of the whole iterator stricture. All callers changed.
242 2009-10-04 Eli Zaretskii <eliz@gnu.org>
244 * bidi.c (bidi_at_paragraph_end): Check for paragraph-start if
245 paragraph-separate failed to match. Return the length of the
247 (bidi_line_init): New function.
248 (bidi_paragraph_init): Use bidi_line_init. Do nothing if in the
249 middle of a paragraph-separate sequence. Don't override existing
250 paragraph direction if no strong characters found in this
251 paragraph. Set separator_limit according to what
252 bidi_at_paragraph_end returns. Reset new_paragraph flag when a
253 new paragraph is found.
254 (bidi_init_it): Reset separator_limit.
256 * dispextern.h (struct bidi_it): New member separator_limit.
258 * bidi.c (bidi_find_paragraph_start): Return the byte position of
259 the paragraph beginning.
261 * xdisp.c (set_iterator_to_next): Call bidi_paragraph_init if the
262 new_paragraph flag is set in the bidi iterator.
264 * bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): Use
265 the buffer-local value of paragraph-start and paragraph-separate.
267 2009-10-03 Eli Zaretskii <eliz@gnu.org>
269 * bidi.c (bidi_set_paragraph_end): Don't set the new_paragraph
270 flag in the iterator.
271 (bidi_init_it): Set the new_paragraph flag.
272 (bidi_at_paragraph_end): Arguments are now character and byte
273 position of the next character. All callers changed.
274 (bidi_resolve_explicit): Don't call bidi_at_paragraph_end, and
275 don't behave as if at paragraph end if it returns true.
276 (bidi_get_next_char_visually): Don't call bidi_paragraph_init if
277 new_paragraph flags is set. Set new_paragraph flag when at end of
279 <fallback_paragraph_start_re, fallback_paragraph_separate_re>: New
281 <Qparagraph_start, Qparagraph_separate>: New variables.
282 (bidi_initialize): Initialize and staticpro them.
284 * dispextern.h <struct bidi_it>: New element paragraph_dir. Make
285 positional elements EMACS_INT.
287 * bidi.c <bidi_overriding_paragraph_direction>: Delete.
289 2009-09-28 Eli Zaretskii <eliz@gnu.org>
291 * bidi.c (bidi_init_it): Initialize charpos, bytepos, and
292 first_elt before calling bidi_set_paragraph_end.
293 (bidi_resolve_explicit): Don't call bidi_set_paragraph_end at
295 (bidi_at_paragraph_end): Don't set new_paragraph flag at EOB.
296 (bidi_get_type): Accept an additional argument OVERRIDE, per UAX#9
297 "Explicit Overrides". All callers changed.
299 2009-09-27 Eli Zaretskii <eliz@gnu.org>
301 * xdisp.c (next_element_from_buffer): If called not at line
302 beginning, start bidi iteration from line beginning.
304 * bidi.c (bidi_paragraph_init): Use
305 bidi_overriding_paragraph_direction instead of a literal zero.
306 (bidi_initialize): Fix some character types, per Unicode 5.x.
307 (bidi_get_type): Abort if called with invalid character code.
309 * dispextern.h: Add prototype of bidi_mirror_char.
311 * xdisp.c (get_next_display_element): Mirror characters whose
312 resolved type is STRONG_R.
314 2009-09-26 Eli Zaretskii <eliz@gnu.org>
316 * bidi.c (bidi_paragraph_init): Don't set bidi_it->ch_len. Abort
317 if called not at beginning of a new paragraph.
318 (bidi_get_next_char_visually): Prepare and use a sentinel iterator
319 state when first_elt flag is set.
321 * dispextern.h (struct bidi_it): New struct member first_elt.
323 * bidi.c (bidi_init_it): Initialize bidi_it->first_elt.
324 (bidi_copy_it): Don't copy the first_elt flag.
326 * xdisp.c (reseat_1): Initialize bidi_it.first_elt. Move bidi
327 scan start code from here...
328 (next_element_from_buffer): ...to here. Use bidi_it.first_elt
331 2009-09-20 Eli Zaretskii <eliz@gnu.org>
333 * xdisp.c (reseat_1): Handle position < BEGV.
335 * bidi.c (bidi_paragraph_init): Set bidi_it->ch_len. Handle ZV.
336 (bidi_init_it): Don't initialize bidi_it->ch_len.
337 (bidi_resolve_explicit_1): Abort if bidi_it->ch_len was not
339 (bidi_at_paragraph_end, bidi_resolve_explicit_1)
340 (bidi_resolve_weak, bidi_level_of_next_char): Handle bytepos at
342 (bidi_resolve_explicit_1): Handle position < BEGV.
344 2009-09-19 Eli Zaretskii <eliz@gnu.org>
346 * xdisp.c (init_iterator): Call bidi_init_it. Set
347 bidi_it->bytepos if buffer position specified.
348 (reseat_1): Don't call bidi_init_it. Call bidi_paragraph_init
349 instead. Move back to preceding character before the call to
350 bidi_get_next_char_visually.
352 * bidi.c: Remove all STANDALONE parts.
353 (bidi_init_it): Init bidi_it->charpos and bidi_it->bytepos to -1.
354 Don't call bidi_paragraph_init. Change arguments.
355 (bidi_paragraph_init): Remove code for negative pos.
357 * dispextern.h <bidi_it>: Rename orig_type to type_after_w1 and
358 pristine_type to orig_type.
360 2009-09-12 Eli Zaretskii <eliz@gnu.org>
362 * dispnew.c (direct_output_for_insert): Give up if we are
363 reordering bidirectional text.
365 * dispextern.h (IT_STACK_SIZE): Enlarge to 5.
367 * xdisp.c (display_line): Set row->end and it->start for the next
368 row to the next character in logical order. If we are reordering
369 bidi text, push and pop the iterator before and after momentarily
370 iterating in logical order.
372 2009-09-11 Eli Zaretskii <eliz@gnu.org>
374 Note: The following changes were undone on 2009-09-12.
376 * xdisp.c (set_iterator_to_next, reseat, reseat_1)
377 (reseat_at_next_visible_line_start): Accept additional argument
378 force_logical_p; all callers changed. If force_logical_p is
379 non-zero, force iteration in buffer's logical order even in bidi
382 * dispnew.c (direct_output_for_insert): Call set_iterator_to_next
383 with additional argument zero.
385 * dispextern.h (set_iterator_to_next): Now accepts an additional
388 2009-08-29 Eli Zaretskii <eliz@gnu.org>
390 * xdisp.c (set_cursor_from_row): Don't assume glyph->charpos
392 (try_window_reusing_current_matrix): Don't assume glyph->charpos
395 2009-08-28 Eli Zaretskii <eliz@gnu.org>
397 * bidi.c <bidi_overriding_paragraph_direction>: Default to L2R,
400 2009-08-22 Eli Zaretskii <eliz@gnu.org>
402 * bidi.c (bidi_initialize): staticpro bidi_char_table.
403 (bidi_check_type): New function.
404 (bidi_cache_iterator_state, bidi_remember_char)
405 (bidi_resolve_explicit_1, bidi_resolve_explicit)
406 (bidi_resolve_weak, bidi_resolve_neutral)
407 (bidi_level_of_next_char): Use it to validate the bidi type
408 assigned to the iterator.
410 2009-08-15 Eli Zaretskii <eliz@gnu.org>
412 * bidi.c (bidi_initialize): Fix initialization of bidi_type_table.
414 * xdisp.c (set_iterator_to_next): Fix position setting after call
415 to bidi_get_next_char_visually.
417 2005-12-03 Eli Zaretskii <eliz@gnu.org>
419 * bidi.c: Include stdio.h unconditionally. Fix and elaborate
420 commentary. Add Copyright blurb.
422 2004-03-08 Kenichi Handa <handa@m17n.org>
424 * xdisp.c (reseat_1): Call bidi_init_it with a previous position.
426 * bidi.c (bidi_init_it): Set bidi_it->ch_len even if POS > 0.
428 2004-03-04 Kenichi Handa <handa@m17n.org>
430 The following changes are to support bidirectional text display.
432 * Makefile.in (obj): Include bidi.o.
433 (bidi.o): New target.
437 * buffer.h (struct buffer): New member bidi_display_reordering.
439 * buffer.c (init_buffer_once): Initialize bidi_display_reordering.
440 (syms_of_buffer): Declarations of Lisp variables
441 default-bidi-display-reordering and bidi-display-reordering.
443 * dispextern.h (BIDI_MAXLEVEL): New macro.
444 (bidi_type_t, bidi_dir_t): New types.
445 (bidi_saved_info, bidi_stack, bidi_it): New structs.
446 (struct it): New members bidi_p and bidi_it.
447 (bidi_init_it): Extern it.
448 (bidi_get_next_char_visually): Extern it.
450 * dispnew.c (direct_output_forward_char): Give up if we need bidi
451 processing or buffer's direction is right-to-left.
453 * xdisp.c (init_iterator): Initialize it->bidi_p.
454 (reseat_1): Cal bidi_init_it and bidi_get_next_char_visually if
456 (set_iterator_to_next): Cal bidi_get_next_char_visually if
462 ;; add-log-time-zone-rule: t
465 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
467 This file is part of GNU Emacs.
469 GNU Emacs is free software: you can redistribute it and/or modify
470 it under the terms of the GNU General Public License as published by
471 the Free Software Foundation, either version 3 of the License, or
472 (at your option) any later version.
474 GNU Emacs is distributed in the hope that it will be useful,
475 but WITHOUT ANY WARRANTY; without even the implied warranty of
476 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
477 GNU General Public License for more details.
479 You should have received a copy of the GNU General Public License
480 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.