diff options
author | nicm <nicm> | 2017-07-21 14:25:29 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-07-21 14:25:29 +0000 |
commit | 8c6ad5532076254ec138f9b598b41d035bdf68e7 (patch) | |
tree | 6f554ac4ba859768dd791127e6f73afe916dd6ab /tty.c | |
parent | e0d49ad7589e5a2c18a81009e797b5b5b198a420 (diff) | |
download | rtmux-8c6ad5532076254ec138f9b598b41d035bdf68e7.tar.gz rtmux-8c6ad5532076254ec138f9b598b41d035bdf68e7.tar.bz2 rtmux-8c6ad5532076254ec138f9b598b41d035bdf68e7.zip |
Trim trailing spaces from full line when it is clearly OK to do so.
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -885,7 +885,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp, u_int i, j, sx, nx, width; int flags, cleared = 0; char buf[512]; - size_t len; + size_t len, old_len; flags = (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) { - tty_attributes(tty, &last, wp); - tty_putn(tty, buf, len, width); + if (grid_cells_equal(&last, &grid_default_cell)) { + 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; |