mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 23:31:55 -08:00
Retrospective commit from 2009-11-14.
Resurrect support for integer values of `cursor' property. Rename paragraph-direction to bidi-paragraph-direction. 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.
This commit is contained in:
parent
21fce5ab36
commit
6c0cf21816
4 changed files with 75 additions and 15 deletions
|
|
@ -1,3 +1,17 @@
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -5188,7 +5188,7 @@ init_buffer_once ()
|
|||
buffer_defaults.ctl_arrow = Qt;
|
||||
buffer_defaults.bidi_display_reordering = Qnil;
|
||||
buffer_defaults.direction_reversed = Qnil;
|
||||
buffer_defaults.paragraph_direction = Qnil;
|
||||
buffer_defaults.bidi_paragraph_direction = Qnil;
|
||||
buffer_defaults.cursor_type = Qt;
|
||||
buffer_defaults.extra_line_spacing = Qnil;
|
||||
buffer_defaults.cursor_in_non_selected_windows = Qt;
|
||||
|
|
@ -5275,7 +5275,7 @@ init_buffer_once ()
|
|||
XSETFASTINT (buffer_local_flags.category_table, idx); ++idx;
|
||||
XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx;
|
||||
XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx;
|
||||
XSETFASTINT (buffer_local_flags.paragraph_direction, idx); ++idx;
|
||||
XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx;
|
||||
XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx);
|
||||
/* Make this one a permanent local. */
|
||||
buffer_permanent_local_flags[idx++] = 1;
|
||||
|
|
@ -5798,8 +5798,8 @@ See also the variable `bidi-display-reordering'. */);
|
|||
doc: /* Non-nil means reorder bidirectional text for display in the visual order.
|
||||
See also the variable `direction-reversed'. */);
|
||||
|
||||
DEFVAR_PER_BUFFER ("paragraph-direction",
|
||||
¤t_buffer->paragraph_direction, Qnil,
|
||||
DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
|
||||
¤t_buffer->bidi_paragraph_direction, Qnil,
|
||||
doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
|
||||
|
||||
If this is nil (the default), the direction of each paragraph is
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ struct buffer
|
|||
/* If non-nil, specifies which direction of text to force in all the
|
||||
paragraphs of the buffer. Nil means determine paragraph
|
||||
direction dynamically for each paragraph. */
|
||||
Lisp_Object paragraph_direction;
|
||||
Lisp_Object bidi_paragraph_direction;
|
||||
/* Non-nil means do selective display;
|
||||
see doc string in syms_of_buffer (buffer.c) for details. */
|
||||
Lisp_Object selective_display;
|
||||
|
|
|
|||
66
src/xdisp.c
66
src/xdisp.c
|
|
@ -2813,9 +2813,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
|
|||
{
|
||||
/* Note the paragraph direction that this buffer wants to
|
||||
use. */
|
||||
if (EQ (current_buffer->paragraph_direction, Qleft_to_right))
|
||||
if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right))
|
||||
it->paragraph_embedding = L2R;
|
||||
else if (EQ (current_buffer->paragraph_direction, Qright_to_left))
|
||||
else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left))
|
||||
it->paragraph_embedding = R2L;
|
||||
else
|
||||
it->paragraph_embedding = NEUTRAL_DIR;
|
||||
|
|
@ -11162,7 +11162,7 @@ text_outside_line_unchanged_p (w, start, end)
|
|||
to find the paragraph limits and widen the range of redisplayed
|
||||
lines to that, but for now just give up this optimization. */
|
||||
if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
|
||||
&& NILP (XBUFFER (w->buffer)->paragraph_direction))
|
||||
&& NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
|
||||
unchanged_p = 0;
|
||||
}
|
||||
|
||||
|
|
@ -12468,6 +12468,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
/* Non-zero means we've seen at least one glyph that came from a
|
||||
display string. */
|
||||
int string_seen = 0;
|
||||
/* Largest buffer position seen during scan of glyph row. */
|
||||
EMACS_INT bpos_max = 0;
|
||||
/* Last buffer position covered by an overlay string with an integer
|
||||
`cursor' property. */
|
||||
EMACS_INT bpos_covered = 0;
|
||||
|
||||
/* Skip over glyphs not having an object at the start and the end of
|
||||
the row. These are special glyphs like truncation marks on
|
||||
|
|
@ -12548,6 +12553,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
{
|
||||
EMACS_INT dpos = glyph->charpos - pt_old;
|
||||
|
||||
if (glyph->charpos > bpos_max)
|
||||
bpos_max = glyph->charpos;
|
||||
if (!glyph->avoid_cursor_p)
|
||||
{
|
||||
/* If we hit point, we've found the glyph on which to
|
||||
|
|
@ -12577,7 +12584,27 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
match_with_avoid_cursor = 1;
|
||||
}
|
||||
else if (STRINGP (glyph->object))
|
||||
string_seen = 1;
|
||||
{
|
||||
Lisp_Object chprop;
|
||||
int glyph_pos = glyph->charpos;
|
||||
|
||||
chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
|
||||
glyph->object);
|
||||
if (INTEGERP (chprop))
|
||||
{
|
||||
bpos_covered = bpos_max + XINT (chprop);
|
||||
/* If the `cursor' property covers buffer positions up
|
||||
to and including point, we should display cursor on
|
||||
this glyph. */
|
||||
if (bpos_covered >= pt_old)
|
||||
{
|
||||
cursor = glyph;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
string_seen = 1;
|
||||
}
|
||||
x += glyph->pixel_width;
|
||||
++glyph;
|
||||
}
|
||||
|
|
@ -12588,6 +12615,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
{
|
||||
EMACS_INT dpos = glyph->charpos - pt_old;
|
||||
|
||||
if (glyph->charpos > bpos_max)
|
||||
bpos_max = glyph->charpos;
|
||||
if (!glyph->avoid_cursor_p)
|
||||
{
|
||||
if (dpos == 0)
|
||||
|
|
@ -12610,7 +12639,26 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
match_with_avoid_cursor = 1;
|
||||
}
|
||||
else if (STRINGP (glyph->object))
|
||||
string_seen = 1;
|
||||
{
|
||||
Lisp_Object chprop;
|
||||
int glyph_pos = glyph->charpos;
|
||||
|
||||
chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
|
||||
glyph->object);
|
||||
if (INTEGERP (chprop))
|
||||
{
|
||||
bpos_covered = bpos_max + XINT (chprop);
|
||||
/* If the `cursor' property covers buffer positions up
|
||||
to and including point, we should display cursor on
|
||||
this glyph. */
|
||||
if (bpos_covered >= pt_old)
|
||||
{
|
||||
cursor = glyph;
|
||||
break;
|
||||
}
|
||||
}
|
||||
string_seen = 1;
|
||||
}
|
||||
--glyph;
|
||||
if (glyph == end)
|
||||
break;
|
||||
|
|
@ -12620,7 +12668,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
/* Step 2: If we didn't find an exact match for point, we need to
|
||||
look for a proper place to put the cursor among glyphs between
|
||||
GLYPH_BEFORE and GLYPH_AFTER. */
|
||||
if (glyph->charpos != pt_old)
|
||||
if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old)
|
||||
&& bpos_covered < pt_old)
|
||||
{
|
||||
if (row->ends_in_ellipsis_p && pos_after == last_pos)
|
||||
{
|
||||
|
|
@ -12707,9 +12756,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
|
|||
cprop = Fget_char_property (make_number (gpos),
|
||||
Qcursor,
|
||||
glyph->object);
|
||||
/* FIXME: This loses the feature of the
|
||||
unidirectional redisplay when the
|
||||
property value was an integer. */
|
||||
if (!NILP (cprop))
|
||||
{
|
||||
cursor = glyph;
|
||||
|
|
@ -15242,7 +15288,7 @@ try_window_id (w)
|
|||
lines to that, but for now just give up this optimization and
|
||||
redisplay from scratch. */
|
||||
if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)
|
||||
&& NILP (XBUFFER (w->buffer)->paragraph_direction))
|
||||
&& NILP (XBUFFER (w->buffer)->bidi_paragraph_direction))
|
||||
GIVE_UP (22);
|
||||
|
||||
/* Make sure beg_unchanged and end_unchanged are up to date. Do it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue