Don't write to bottom-right cell on ttys with AutoWrap (bug#77233)

* src/term.c (tty_write_glyphs): Handle case of writing only one
character in the last column.
This commit is contained in:
Gerd Möllmann 2025-03-27 06:10:46 +01:00
parent c00170e92c
commit 1883a5c717

View file

@ -977,10 +977,20 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
if (AutoWrap (tty)
&& curY (tty) + 1 == FRAME_TOTAL_LINES (f)
&& curX (tty) + len == FRAME_COLS (f)
&& curX (tty) < FRAME_COLS (f) - 1
&& len > 0)
{
/* Write glyphs except the first. */
/* If writing only one glyph in the last column, make that two so
that we can shift that one glyph into the last column. FIXME:
Assuming a display width of 1 looks questionable, but that's
done everywhere else involving auto-wrap. */
if (len == 1)
{
cmgoto (tty, curY (tty), curX (tty) - 1);
--string;
++len;
}
/* Write glyphs except the first. */
int old_x = curX (tty), old_y = curY (tty);
tty_write_glyphs_1 (f, string + 1, len - 1);