1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-25 01:10:47 -08:00

Fix subtle problems with linum-mode and invisible text

src/xdisp.c (handle_invisible_prop): Fix up it->position even when
 we are going to load overlays at the beginning of the invisible
 text.
 (setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p
 flag also here.
 (next_overlay_string): Set the overlay_strings_at_end_processed_p
 flag only if the overlays just processed were actually loaded at
 EOB.
This commit is contained in:
Eli Zaretskii 2015-03-15 19:17:46 +02:00
parent 28caedba0f
commit 4e5eb85425
2 changed files with 48 additions and 19 deletions

View file

@ -1,3 +1,14 @@
2015-03-15 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (handle_invisible_prop): Fix up it->position even when
we are going to load overlays at the beginning of the invisible
text.
(setup_for_ellipsis): Reset the ignore_overlay_strings_at_pos_p
flag also here.
(next_overlay_string): Set the overlay_strings_at_end_processed_p
flag only if the overlays just processed were actually loaded at
EOB.
2015-03-14 Daniel Colascione <dancol@dancol.org>
* emacs.c (standard_args): Add --no-x-resources.

View file

@ -4412,6 +4412,27 @@ handle_invisible_prop (struct it *it)
IT_BYTEPOS (*it) = CHAR_TO_BYTE (newpos);
}
if (display_ellipsis_p)
{
/* Make sure that the glyphs of the ellipsis will get
correct `charpos' values. If we would not update
it->position here, the glyphs would belong to the
last visible character _before_ the invisible
text, which confuses `set_cursor_from_row'.
We use the last invisible position instead of the
first because this way the cursor is always drawn on
the first "." of the ellipsis, whenever PT is inside
the invisible text. Otherwise the cursor would be
placed _after_ the ellipsis when the point is after the
first invisible character. */
if (!STRINGP (it->object))
{
it->position.charpos = newpos - 1;
it->position.bytepos = CHAR_TO_BYTE (it->position.charpos);
}
}
/* If there are before-strings at the start of invisible
text, and the text is invisible because of a text
property, arrange to show before-strings because 20.x did
@ -4443,23 +4464,6 @@ handle_invisible_prop (struct it *it)
}
else if (display_ellipsis_p)
{
/* Make sure that the glyphs of the ellipsis will get
correct `charpos' values. If we would not update
it->position here, the glyphs would belong to the
last visible character _before_ the invisible
text, which confuses `set_cursor_from_row'.
We use the last invisible position instead of the
first because this way the cursor is always drawn on
the first "." of the ellipsis, whenever PT is inside
the invisible text. Otherwise the cursor would be
placed _after_ the ellipsis when the point is after the
first invisible character. */
if (!STRINGP (it->object))
{
it->position.charpos = newpos - 1;
it->position.bytepos = CHAR_TO_BYTE (it->position.charpos);
}
it->ellipsis_p = true;
/* Let the ellipsis display before
considering any properties of the following char.
@ -4504,6 +4508,11 @@ setup_for_ellipsis (struct it *it, int len)
if (it->saved_face_id < 0 || it->saved_face_id != it->face_id)
it->saved_face_id = it->face_id = DEFAULT_FACE_ID;
/* If the ellipsis represents buffer text, it means we advanced in
the buffer, so we should no longer ignore overlay strings. */
if (it->method == GET_FROM_BUFFER)
it->ignore_overlay_strings_at_pos_p = false;
it->method = GET_FROM_DISPLAY_VECTOR;
it->ellipsis_p = true;
}
@ -5427,7 +5436,6 @@ next_overlay_string (struct it *it)
&& it->stop_charpos <= it->end_charpos));
it->current.overlay_string_index = -1;
it->n_overlay_strings = 0;
it->overlay_strings_charpos = -1;
/* If there's an empty display string on the stack, pop the
stack, to resync the bidi iterator with IT's position. Such
empty strings are pushed onto the stack in
@ -5444,8 +5452,18 @@ next_overlay_string (struct it *it)
/* If we're at the end of the buffer, record that we have
processed the overlay strings there already, so that
next_element_from_buffer doesn't try it again. */
if (NILP (it->string) && IT_CHARPOS (*it) >= it->end_charpos)
if (NILP (it->string)
&& IT_CHARPOS (*it) >= it->end_charpos
&& it->overlay_strings_charpos >= it->end_charpos)
it->overlay_strings_at_end_processed_p = true;
/* Note: we reset overlay_strings_charpos only here, to make
sure the just-processed overlays were indeed at EOB.
Otherwise, overlays on text with invisible text property,
which are processed with IT's position past the invisible
text, might fool us into thinking the overlays at EOB were
already processed (linum-mode can cause this, for
example). */
it->overlay_strings_charpos = -1;
}
else
{