mirror of
https://github.com/tmux/tmux.git
synced 2025-04-14 07:18:49 +00:00
Trim trailing spaces from full line when it is clearly OK to do so.
This commit is contained in:
parent
e0d49ad758
commit
8c6ad55320
15
tty.c
15
tty.c
@ -885,7 +885,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
u_int i, j, sx, nx, width;
|
u_int i, j, sx, nx, width;
|
||||||
int flags, cleared = 0;
|
int flags, cleared = 0;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
size_t len;
|
size_t len, old_len;
|
||||||
|
|
||||||
flags = (tty->flags & TTY_NOCURSOR);
|
flags = (tty->flags & TTY_NOCURSOR);
|
||||||
tty->flags |= TTY_NOCURSOR;
|
tty->flags |= TTY_NOCURSOR;
|
||||||
@ -973,8 +973,17 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
tty_attributes(tty, &last, wp);
|
if (grid_cells_equal(&last, &grid_default_cell)) {
|
||||||
tty_putn(tty, buf, len, width);
|
old_len = len;
|
||||||
|
while (len > 0 && buf[len - 1] == ' ')
|
||||||
|
len--;
|
||||||
|
log_debug("%s: trimmed %zu spaces", __func__,
|
||||||
|
old_len - len);
|
||||||
|
}
|
||||||
|
if (len != 0) {
|
||||||
|
tty_attributes(tty, &last, wp);
|
||||||
|
tty_putn(tty, buf, len, width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nx = screen_size_x(s) - sx;
|
nx = screen_size_x(s) - sx;
|
||||||
|
Loading…
Reference in New Issue
Block a user