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;
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;
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
{
/* 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;
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;
}
/* 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
{
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
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;
}
{
EMACS_INT dpos = glyph->charpos - pt_old;
+ if (glyph->charpos > bpos_max)
+ bpos_max = glyph->charpos;
if (!glyph->avoid_cursor_p)
{
if (dpos == 0)
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;
/* 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)
{
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;
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