view src/ChangeLog.bidi @ 107643:a5c1ccd17b3c

Finish work on cursor motion in continuation lines. xdisp.c (set_cursor_from_row): Don't miss a candidate row whose glyph->charpos is an exact match for point. (try_cursor_movement): Don't give up if rows are bidi-reordered and point moved backwards. Instead, back up to the row that is not a continuation line.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 20 Mar 2010 10:32:32 -0400
parents d65c199e8bdd
children 6e29ba4351e0
line wrap: on
line source

2010-03-20  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Don't miss a candidate row whose
	glyph->charpos is an exact match for point.
	(try_cursor_movement): Don't give up if rows are bidi-reordered
	and point moved backwards.  Instead, back up to the row that is
	not a continuation line.

2010-03-13  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (try_cursor_movement): Give up if rows are
	bidi-reordered and point moved backwards.  Examine all the
	candidate rows that occlude point, to return the best match.
	(row_containing_pos): With bidi-reordered rows, don't return the
	first one that occludes point; rather, examine all candidates and
	return the best match, with he glyph that's closest to point.
	(display_line): When looking for min position, don't consider
	negative values of glyph->charpos.  (Fixes a crash with "C-x 3" at
	ZV.)  Record the position after EOL in it->eol_pos, and use it to
	set end_pos of the last row produced for a continued line.  Fix
	the condition for passing candidate rows to set_cursor_from_row:
	check ends_at_zv_p flag of the best candidate row, not of the
	current row.

	* dispextern.h (struct it): New member eol_pos.

	* .gdbinit (prowlims): Display the ends_at_zv_p flag.

2010-03-06  Eli Zaretskii  <eliz@gnu.org>

	* .gdbinit (prowlims, pmtxrows): New commands.

	* xdisp.c (display_line): Special-case the calculation of row->end
	in rows that end at ZV, to avoid abort in CHAR_TO_BYTE.  Handle
	empty lines correctly when calculating row's max and min pos.
	Display cursor at the first glyph row that has its ends_at_zv_p
	flag set.

2010-02-20  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Compare candidate cursor
	positions only in rows whose buffer positions occlude point.
	(display_line): Fix computation of row->start and row->end for
	empty lines.

	* dispnew.c (row_equal_p): Compare the reversed_p attributes as
	well.

2010-02-13  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Don't overwrite cursor position
	if it is not a better candidate than what we already have.
	(display_line): Keep calling set_cursor_from_row for
	bidi-reordered rows even if we already have a possible candidate
	for cursor position.  Undo the row_end setting throughout the
	code, and instead do it after all the row's glyphs have been
	produced, by looping over the glyphs.

2010-02-06  Eli Zaretskii  <eliz@gnu.org>

	Start working on cursor movement in continuation lines.
	* xdisp.c (move_it_in_display_line_to): New variables prev_method
	and prev_pos.  Compare for strict equality in
	BUFFER_POS_REACHED_P.

2010-01-30  Eli Zaretskii  <eliz@gnu.org>

	Fix fallout from changes to managing glyph row reversed_p flag.
	* xdisp.c (init_iterator): Initialize it->glyph_row->reversed_p
	flag.

2010-01-25  Eli Zaretskii  <eliz@gnu.org>

	Clean up the mess with setting the glyph row reversed_p flag.
	* dispnew.c (prepare_desired_row): Preserve the reversed_p flag.

	* bidi.c (bidi_cache_find): Use bidi_copy_it instead of copying
	the whole struct (which includes uninitialized parts).
	(bidi_init_it): Don't initialize bidi_it->paragraph_dir.

	* xdisp.c (display_line): Remove misplaced setting of
	row->reversed_p flags.  Copy the reversed_p flag to the next glyph
	row.
	(next_element_from_buffer): Check bidi_it.paragraph_dir rather
	than level_stack[0].level.  Reset the reversed_p flag for non-R2L
	paragraphs.

	Fix display of invisible text.
	* xdisp.c (handle_invisible_prop): If we are `reseat'ed, init the
	paragraph direction and set the `reversed_p' flag in the IT's
	glyph row.  Fix exit conditions of the loop that skips invisible
	text.  Update IT->prev_stop after skipping invisible text.  Check
	for additional overlays at IT->stop_charpos, not at start_pos.

2010-01-16  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (handle_invisible_prop): Under bidi iteration, skip
	invisible text using bidi_get_next_char_visually.
	(handle_stop_backwards): Restore it->bidi_p, it->current and
	it->position before calling handle_stop.
	(next_element_from_buffer): Fix formatting.

2010-01-09  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (handle_stop_backwards): Add a prototype.
	(reseat): call handle_stop_backwards to recompute prev_stop and
	base_level_stop for the new position.  Solves the crash when
	scrolling backwards.

2010-01-02  Eli Zaretskii  <eliz@gnu.org>

	* .gdbinit (pitx): Display some bidi information about the
	iterator.

	* dispextern.h (BIDI_AT_BASE_LEVEL): Enclose definition in
	parentheses.

	* xdisp.c (handle_stop_backwards): Save and restore it->current
	and it->position, instead of expecting the caller to do that.
	(next_element_from_buffer): When moving across stop_charpos,
	record it in prev_stop.  When IT_CHARPOS backs up, call
	handle_stop_backwards only if above the base embedding level.
	This solves the crash while displaying etc/HELLO in bidi mode.

2009-12-26  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (handle_stop_backwards): Call compute_stop_pos in the
	loop, instead of calling handle_stop.  Call handle_stop only once,
	after the loop.
	(next_element_from_buffer): Don't call handle_stop_backwards if at
	stop position.  If base_level_stop is zero, set it to 1.

	* term.c (append_glyph): Fill resolved_level and bidi_type slots
	of struct glyph for unidirectional display.

	* xdisp.c (set_cursor_from_row): Handle zero-width characters.

	* bidi.c (bidi_mirror_char): More efficient code (suggested by
	Ehud Karni <ehud@unix.mvs.co.il>).  Don't even try to mirror
	non-ASCII characters.

2009-12-19  Eli Zaretskii  <eliz@gnu.org>

	* buffer.c (Fbuffer_swap_text): Swap the values of
	bidi_display_reordering and bidi_paragraph_direction.

	* bidi.c (bidi_resolve_weak): Fix nesting of conditions for Wn
	processing.  Move W3 after W1 and W2.  Simplify W4 because it is
	now always after W1.

	* .gdbinit (pbiditype): New command.
	(pgx): Use it to display bidi level and type of the glyph.

2009-12-12  Eli Zaretskii  <eliz@gnu.org>

	* dispextern.h (struct it): New members prev_stop and
	base_level_stop.

	* xdisp.c (handle_stop_backwards): New function.
	(next_element_from_buffer): Handle the situation where we
	overstepped stop_charpos due to non-linearity of the bidi
	iteration.  Likewise for when we back up beyond the previous
	stop_charpos.
	(reseat_1, pop_it, push_it): Set prev_stop and base_level_stop.

	* dispextern.h (BIDI_AT_BASE_LEVEL): New macro.

	* bidi.c (bidi_copy_it): Fix compiler warning due to cast of a
	pointer to `int'.  Don't preserve the first_elt member, as it is
	no longer copied, because its position in the structure was
	changed, see below.

	* dispextern.h (struct bidi_it): Move first_elt, new_paragraph,
	separator_limit, and paragraph_dir to after bidi_stack.  Add a
	note that anything beyond the level stack is not preserved when
	the bidi iterator state is copied/saved.

2009-11-21  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
	lines when integer values of `cursor' property is used on display
	strings.

2009-11-14  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (init_iterator, text_outside_line_unchanged_p)
	(try_window_id): Rename paragraph_direction to
	bidi_paragraph_direction.
	(set_cursor_from_row): Handle integer values of `cursor' property
	on display strings.

	* buffer.c (init_buffer_once, syms_of_buffer): Rename
	paragraph_direction to bidi_paragraph_direction.

	* buffer.h (struct buffer): Rename paragraph_direction to
	bidi_paragraph_direction.

2009-11-07  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_paragraph_init): Don't overstep end of buffer.
	Treat end of buffer as a NEUTRAL_B character.
	(bidi_resolve_explicit): Don't special-case ZV when bidi_it->type
	is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the
	new_paragraph flag.

2009-10-31  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (display_line): Always extend reversed_p rows to the end
	of line.
	(set_cursor_from_row): In R2L rows that don't display text, put
	the cursor on the rightmost glyph.

2009-10-24  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Fix off-by-one error when
	skipping over non-character glyphs at end of a reversed row.

	* dispextern.h (struct glyph): The `resolved_level' member needs
	only 5 bits, not 6.  The `bidi_type' member needs only 3 bits.
	(bidi_type_t): Rearrange so that types that can appear in the
	resolved type are at the beginning and have values less than 8.

2009-10-23  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c: Include setjmp.h.

2009-10-17  Eli Zaretskii  <eliz@gnu.org>

	* dispextern.h (struct glyph): New members resolved_level and
	bidi_type.

	* xdisp.c (append_glyph, append_composite_glyph)
	(produce_image_glyph, append_stretch_glyph): Set them.

	* term.c (append_glyph): Ditto.

	* xdisp.c (display_line, next_element_from_buffer): Set the glyph
	row's reversed_p flag if the paragraph base direction is odd.
	(extend_face_to_end_of_line): Don't reverse the glyphs here.

	* term.c (append_glyph): Reverse glyphs here.

	* bidi.c (bidi_get_next_char_visually): Don't exit early when at
	ZV.
	(bidi_paragraph_init): Don't step over a newline if at BEGV.

2009-10-16  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_paragraph_init): Handle empty buffers.

2009-10-10  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Skip over glyphs near end of row
	with integer OBJECT even if their CHARPOS is zero.

	* bidi.c (bidi_cache_iterator_state): Don't cache NEW_PARAGRAPH.
	Abort if someone tries to add a cached state whose position is not
	the immediate successor to that of the last cached state.
	(bidi_paragraph_init): Don't bail out too early after a reseat.

2009-10-09  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (text_outside_line_unchanged_p, try_window_id): Disable
	optimizations if we are reordering bidirectional text and the
	paragraph direction can be affected by the change.

2009-10-08  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (string_buffer_position_lim): New function.
	(string_buffer_position): Most of code moved to
	string_buffer_position_lim.  Last argument and return value are
	now EMACS_INT; all callers changed.
	(set_cursor_from_row): Rewritten to support bidirectional text and
	reversed glyph rows.

	dispextern.h <string_buffer_position>: Update prototype.

2009-10-07  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_paragraph_init): Fix initialization of POS.

	* dispextern.h (struct glyph_row): New member reversed_p.

2009-10-06  Eli Zaretskii  <eliz@gnu.org>

	* buffer.c (syms_of_buffer): Remove DEFVAR_LISP_NOPRO for
	default-direction-reversed, default-bidi-display-reordering, and
	default-paragraph-direction.

2009-10-05  Eli Zaretskii  <eliz@gnu.org>

	* buffer.h (struct buffer): New member paragraph_direction.
	* buffer.c (init_buffer_once): Initialize it.
	(syms_of_buffer): Declare Lisp variables
	default-paragraph-direction and paragraph-direction.

	* dispextern.h (struct it): New member paragraph_embedding.
	* xdisp.c (init_iterator): Initialize it from the buffer's value
	of paragraph-direction.
	<Qright_to_left, Qleft_to_right>: New variables.
	(syms_of_xdisp): Initialize and staticpro them.
	(set_iterator_to_next, next_element_from_buffer): Use the value of
	paragraph_embedding to determine the paragraph direction.

	* bidi.c (bidi_line_init): Fix second argument to
	bidi_set_sor_type.
	(bidi_init_it): Initialize paragraph_dir to NEUTRAL_DIR.
	(bidi_get_next_char_visually): Record the last character of the
	separator in separator_limit, not the character after that.
	(bidi_find_paragraph_start): Accept character and byte positions
	instead of the whole iterator stricture.  All callers changed.

2009-10-04  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_at_paragraph_end): Check for paragraph-start if
	paragraph-separate failed to match.  Return the length of the
	matched separator.
	(bidi_line_init): New function.
	(bidi_paragraph_init): Use bidi_line_init.  Do nothing if in the
	middle of a paragraph-separate sequence.  Don't override existing
	paragraph direction if no strong characters found in this
	paragraph.  Set separator_limit according to what
	bidi_at_paragraph_end returns.  Reset new_paragraph flag when a
	new paragraph is found.
	(bidi_init_it): Reset separator_limit.

	* dispextern.h (struct bidi_it): New member separator_limit.

	* bidi.c (bidi_find_paragraph_start): Return the byte position of
	the paragraph beginning.

	* xdisp.c (set_iterator_to_next): Call bidi_paragraph_init if the
	new_paragraph flag is set in the bidi iterator.

	* bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): Use
	the buffer-local value of paragraph-start and paragraph-separate.

2009-10-03  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_set_paragraph_end): Don't set the new_paragraph
	flag in the iterator.
	(bidi_init_it): Set the new_paragraph flag.
	(bidi_at_paragraph_end): Arguments are now character and byte
	position of the next character.  All callers changed.
	(bidi_resolve_explicit): Don't call bidi_at_paragraph_end, and
	don't behave as if at paragraph end if it returns true.
	(bidi_get_next_char_visually): Don't call bidi_paragraph_init if
	new_paragraph flags is set.  Set new_paragraph flag when at end of
	a paragraph.
	<fallback_paragraph_start_re, fallback_paragraph_separate_re>: New
	variables.
	<Qparagraph_start, Qparagraph_separate>: New variables.
	(bidi_initialize): Initialize and staticpro them.

	* dispextern.h <struct bidi_it>: New element paragraph_dir.  Make
	positional elements EMACS_INT.

	* bidi.c <bidi_overriding_paragraph_direction>: Delete.

2009-09-28  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_init_it): Initialize charpos, bytepos, and
	first_elt before calling bidi_set_paragraph_end.
	(bidi_resolve_explicit): Don't call bidi_set_paragraph_end at
	EOB.
	(bidi_at_paragraph_end): Don't set new_paragraph flag at EOB.
	(bidi_get_type): Accept an additional argument OVERRIDE, per UAX#9
	"Explicit Overrides".  All callers changed.

2009-09-27  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (next_element_from_buffer): If called not at line
	beginning, start bidi iteration from line beginning.

	* bidi.c (bidi_paragraph_init): Use
	bidi_overriding_paragraph_direction instead of a literal zero.
	(bidi_initialize): Fix some character types, per Unicode 5.x.
	(bidi_get_type): Abort if called with invalid character code.

	* dispextern.h: Add prototype of bidi_mirror_char.

	* xdisp.c (get_next_display_element): Mirror characters whose
	resolved type is STRONG_R.

2009-09-26  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_paragraph_init): Don't set bidi_it->ch_len.  Abort
	if called not at beginning of a new paragraph.
	(bidi_get_next_char_visually): Prepare and use a sentinel iterator
	state when first_elt flag is set.

	* dispextern.h (struct bidi_it): New struct member first_elt.

	* bidi.c (bidi_init_it): Initialize bidi_it->first_elt.
	(bidi_copy_it): Don't copy the first_elt flag.

	* xdisp.c (reseat_1): Initialize bidi_it.first_elt.  Move bidi
	scan start code from here...
	(next_element_from_buffer): ...to here.  Use bidi_it.first_elt
	flag.

2009-09-20  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (reseat_1): Handle position < BEGV.

	* bidi.c (bidi_paragraph_init): Set bidi_it->ch_len.  Handle ZV.
	(bidi_init_it): Don't initialize bidi_it->ch_len.
	(bidi_resolve_explicit_1): Abort if bidi_it->ch_len was not
	initialized.
	(bidi_at_paragraph_end, bidi_resolve_explicit_1)
	(bidi_resolve_weak, bidi_level_of_next_char): Handle bytepos at
	ZV_BYTE.
	(bidi_resolve_explicit_1): Handle position < BEGV.

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
	reordering bidirectional text.

	* dispextern.h (IT_STACK_SIZE): Enlarge to 5.

	* xdisp.c (display_line): Set row->end and it->start for the next
	row to the next character in logical order.  If we are reordering
	bidi text, push and pop the iterator before and after momentarily
	iterating in logical order.

2009-09-11  Eli Zaretskii  <eliz@gnu.org>

	Note: The following changes were undone on 2009-09-12.

	* xdisp.c (set_iterator_to_next, reseat, reseat_1)
	(reseat_at_next_visible_line_start): Accept additional argument
	force_logical_p; all callers changed.  If force_logical_p is
	non-zero, force iteration in buffer's logical order even in bidi
	buffers.

	* dispnew.c (direct_output_for_insert): Call set_iterator_to_next
	with additional argument zero.

	* dispextern.h (set_iterator_to_next): Now accepts an additional
	argument.

2009-08-29  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Don't assume glyph->charpos
	increments linearly.
	(try_window_reusing_current_matrix): Don't assume glyph->charpos
	increments linearly.

2009-08-28  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c <bidi_overriding_paragraph_direction>: Default to L2R,
	for now.

2009-08-22  Eli Zaretskii  <eliz@gnu.org>

	* bidi.c (bidi_initialize): staticpro bidi_char_table.
	(bidi_check_type): New function.
	(bidi_cache_iterator_state, bidi_remember_char)
	(bidi_resolve_explicit_1, bidi_resolve_explicit)
	(bidi_resolve_weak, bidi_resolve_neutral)
	(bidi_level_of_next_char): Use it to validate the bidi type
	assigned to the iterator.

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
	commentary.  Add Copyright blurb.

2004-03-08  Kenichi Handa  <handa@m17n.org>

	* xdisp.c (reseat_1): Call bidi_init_it with a previous position.

	* bidi.c (bidi_init_it): Set bidi_it->ch_len even if POS > 0.

2004-03-04  Kenichi Handa  <handa@m17n.org>

	The following changes are to support bidirectional text display.

	* Makefile.in (obj): Include bidi.o.
	(bidi.o): New target.

	* bidi.c: New file.

	* buffer.h (struct buffer): New member bidi_display_reordering.

	* buffer.c (init_buffer_once): Initialize bidi_display_reordering.
	(syms_of_buffer): Declarations of Lisp variables
	default-bidi-display-reordering and bidi-display-reordering.

	* dispextern.h (BIDI_MAXLEVEL): New macro.
	(bidi_type_t, bidi_dir_t): New types.
	(bidi_saved_info, bidi_stack, bidi_it): New structs.
	(struct it): New members bidi_p and bidi_it.
	(bidi_init_it): Extern it.
	(bidi_get_next_char_visually): Extern it.

	* dispnew.c (direct_output_forward_char): Give up if we need bidi
	processing or buffer's direction is right-to-left.

	* xdisp.c (init_iterator): Initialize it->bidi_p.
	(reseat_1): Cal bidi_init_it and bidi_get_next_char_visually if
	necessary.
	(set_iterator_to_next): Cal bidi_get_next_char_visually if
	necessary.


;; Local Variables:
;; coding: utf-8
;; add-log-time-zone-rule: t
;; End:

    Copyright (C) 2007, 2008, 2009  Free Software Foundation, Inc.

  This file is part of GNU Emacs.

  GNU Emacs is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GNU Emacs is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.