Fix line-truncation on horizontally-split TTY frames

* src/term.c (append_glyph, append_composite_glyph)
(append_glyphless_glyph): Account for the right-border glyph
when computing the end glyph of TEXT_AREA.  (Bug#80900)
This commit is contained in:
Eli Zaretskii 2026-04-25 14:39:53 +03:00
parent aa067441d6
commit 700768cd1d

View file

@ -1548,7 +1548,15 @@ append_glyph (struct it *it)
eassert (it->glyph_row); eassert (it->glyph_row);
glyph = (it->glyph_row->glyphs[it->area] glyph = (it->glyph_row->glyphs[it->area]
+ it->glyph_row->used[it->area]); + it->glyph_row->used[it->area]);
end = it->glyph_row->glyphs[1 + it->area]; /* The last glyph of TEXT_AREA in all windows but the rightmost one is
the border glyph, except when the window has the right margin. */
int reserve_last =
it->area == TEXT_AREA
/* Exclude mode/header/tab lines and menu/tool bars. */
&& !it->glyph_row->full_width_p
&& !WINDOW_RIGHTMOST_P (it->w)
&& WINDOW_RIGHT_MARGIN_WIDTH (it->w) == 0;
end = it->glyph_row->glyphs[1 + it->area] - reserve_last;
/* If the glyph row is reversed, we need to prepend the glyph rather /* If the glyph row is reversed, we need to prepend the glyph rather
than append it. */ than append it. */
@ -1773,7 +1781,15 @@ append_composite_glyph (struct it *it)
eassert (it->glyph_row); eassert (it->glyph_row);
glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
if (glyph < it->glyph_row->glyphs[1 + it->area]) /* The last glyph of TEXT_AREA in all windows but the rightmost one is
the border glyph, except when the window has the right margin. */
int reserve_last =
it->area == TEXT_AREA
/* Exclude mode/header/tab lines and menu/tool bars. */
&& !it->glyph_row->full_width_p
&& !WINDOW_RIGHTMOST_P (it->w)
&& WINDOW_RIGHT_MARGIN_WIDTH (it->w) == 0;
if (glyph < it->glyph_row->glyphs[1 + it->area] - reserve_last)
{ {
/* If the glyph row is reversed, we need to prepend the glyph /* If the glyph row is reversed, we need to prepend the glyph
rather than append it. */ rather than append it. */
@ -1868,7 +1884,15 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
eassert (it->glyph_row); eassert (it->glyph_row);
glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
end = it->glyph_row->glyphs[1 + it->area]; /* The last glyph of TEXT_AREA in all windows but the rightmost one is
the border glyph, except when the window has the right margin. */
int reserve_last =
it->area == TEXT_AREA
/* Exclude mode/header/tab lines and menu/tool bars. */
&& !it->glyph_row->full_width_p
&& !WINDOW_RIGHTMOST_P (it->w)
&& WINDOW_RIGHT_MARGIN_WIDTH (it->w) == 0;
end = it->glyph_row->glyphs[1 + it->area] - reserve_last;
/* If the glyph row is reversed, we need to prepend the glyph rather /* If the glyph row is reversed, we need to prepend the glyph rather
than append it. */ than append it. */