Fix display of line/wrap-prefix when there's a display property at BOL

* src/xdisp.c (get_line_prefix_it_property): New function.
(handle_line_prefix): Call 'get_line_prefix_it_property' instead
of 'get_it_property', to examine also the property of the buffer
text underlying the display or overlay string.  (Bug#49695)
This commit is contained in:
Eli Zaretskii 2021-07-22 21:23:48 +03:00
parent fcae435f59
commit 662f91a795

View file

@ -22763,6 +22763,22 @@ get_it_property (struct it *it, Lisp_Object prop)
return Fget_char_property (position, prop, object);
}
/* Return the line-prefix/wrap-prefix property, checking both the
current IT->OBJECT and the underlying buffer text. */
static Lisp_Object
get_line_prefix_it_property (struct it *it, Lisp_Object prop)
{
Lisp_Object prefix = get_it_property (it, prop);
/* If we are looking at a display or overlay string, check also the
underlying buffer text. */
if (NILP (prefix) && it->sp > 0 && STRINGP (it->object))
return Fget_char_property (make_fixnum (IT_CHARPOS (*it)), prop,
it->w->contents);
return prefix;
}
/* See if there's a line- or wrap-prefix, and if so, push it on IT. */
static void
@ -22772,13 +22788,13 @@ handle_line_prefix (struct it *it)
if (it->continuation_lines_width > 0)
{
prefix = get_it_property (it, Qwrap_prefix);
prefix = get_line_prefix_it_property (it, Qwrap_prefix);
if (NILP (prefix))
prefix = Vwrap_prefix;
}
else
{
prefix = get_it_property (it, Qline_prefix);
prefix = get_line_prefix_it_property (it, Qline_prefix);
if (NILP (prefix))
prefix = Vline_prefix;
}