Fix 'window-text-pixel-size' at EOL when FROM == TO

* src/xdisp.c (window_text_pixel_size): Reset starting X
coordinate when pretending we begin after the newline, to be
consistent with the iterator's X coordinate.  (Bug#81722)
This commit is contained in:
Eli Zaretskii 2026-08-27 19:10:58 +03:00
parent b28750b822
commit 46e3d4b260

View file

@ -11936,7 +11936,11 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to,
/* If FROM is on a newline, pretend that we start at the beginning
of the next line, because the newline takes no place on display. */
if (FETCH_BYTE (start_bpos) == '\n')
it.current_x = 0, it.wrap_prefix_width = 0;
{
it.current_x = 0;
start_x = 0; /* in case TO == FROM */
it.wrap_prefix_width = 0;
}
if (!NILP (x_limit))
{
it.last_visible_x = max_x;