mirror of
https://github.com/tmux/tmux.git
synced 2025-04-22 12:28:48 +00:00
If there is a double width character at the very end of the line with
not enough room to draw it, just leave it out.
This commit is contained in:
parent
d81fa579c3
commit
aeda2e5808
23
tty.c
23
tty.c
@ -882,6 +882,7 @@ void
|
|||||||
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
||||||
struct screen *s, u_int py, u_int ox, u_int oy)
|
struct screen *s, u_int py, u_int ox, u_int oy)
|
||||||
{
|
{
|
||||||
|
struct grid *gd = s->grid;
|
||||||
struct grid_cell gc, last;
|
struct grid_cell gc, last;
|
||||||
u_int i, j, ux, sx, nx, width;
|
u_int i, j, ux, sx, nx, width;
|
||||||
int flags, cleared = 0;
|
int flags, cleared = 0;
|
||||||
@ -900,15 +901,15 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
* there may be empty background cells after it (from BCE).
|
* there may be empty background cells after it (from BCE).
|
||||||
*/
|
*/
|
||||||
sx = screen_size_x(s);
|
sx = screen_size_x(s);
|
||||||
if (sx > s->grid->linedata[s->grid->hsize + py].cellsize)
|
if (sx > gd->linedata[gd->hsize + py].cellsize)
|
||||||
sx = s->grid->linedata[s->grid->hsize + py].cellsize;
|
sx = gd->linedata[gd->hsize + py].cellsize;
|
||||||
if (sx > tty->sx)
|
if (sx > tty->sx)
|
||||||
sx = tty->sx;
|
sx = tty->sx;
|
||||||
ux = 0;
|
ux = 0;
|
||||||
|
|
||||||
if (wp == NULL ||
|
if (wp == NULL ||
|
||||||
py == 0 ||
|
py == 0 ||
|
||||||
(~s->grid->linedata[s->grid->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
|
(~gd->linedata[gd->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
|
||||||
ox != 0 ||
|
ox != 0 ||
|
||||||
tty->cx < tty->sx ||
|
tty->cx < tty->sx ||
|
||||||
screen_size_x(s) < tty->sx) {
|
screen_size_x(s) < tty->sx) {
|
||||||
@ -932,7 +933,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
width = 0;
|
width = 0;
|
||||||
|
|
||||||
for (i = 0; i < sx; i++) {
|
for (i = 0; i < sx; i++) {
|
||||||
grid_view_get_cell(s->grid, i, py, &gc);
|
grid_view_get_cell(gd, i, py, &gc);
|
||||||
if (len != 0 &&
|
if (len != 0 &&
|
||||||
(((~tty->flags & TTY_UTF8) &&
|
(((~tty->flags & TTY_UTF8) &&
|
||||||
(gc.data.size != 1 ||
|
(gc.data.size != 1 ||
|
||||||
@ -943,6 +944,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
gc.attr != last.attr ||
|
gc.attr != last.attr ||
|
||||||
gc.fg != last.fg ||
|
gc.fg != last.fg ||
|
||||||
gc.bg != last.bg ||
|
gc.bg != last.bg ||
|
||||||
|
ux + width + gc.data.width >= screen_size_x(s) ||
|
||||||
(sizeof buf) - len < gc.data.size)) {
|
(sizeof buf) - len < gc.data.size)) {
|
||||||
tty_attributes(tty, &last, wp);
|
tty_attributes(tty, &last, wp);
|
||||||
tty_putn(tty, buf, len, width);
|
tty_putn(tty, buf, len, width);
|
||||||
@ -956,7 +958,14 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
screen_select_cell(s, &last, &gc);
|
screen_select_cell(s, &last, &gc);
|
||||||
else
|
else
|
||||||
memcpy(&last, &gc, sizeof last);
|
memcpy(&last, &gc, sizeof last);
|
||||||
if (((~tty->flags & TTY_UTF8) &&
|
if (ux + gc.data.width > screen_size_x(s))
|
||||||
|
for (j = 0; j < gc.data.width; j++) {
|
||||||
|
if (ux + j > screen_size_x(s))
|
||||||
|
break;
|
||||||
|
tty_putc(tty, ' ');
|
||||||
|
ux++;
|
||||||
|
}
|
||||||
|
else if (((~tty->flags & TTY_UTF8) &&
|
||||||
(gc.data.size != 1 ||
|
(gc.data.size != 1 ||
|
||||||
*gc.data.data >= 0x7f ||
|
*gc.data.data >= 0x7f ||
|
||||||
gc.data.width != 1)) ||
|
gc.data.width != 1)) ||
|
||||||
@ -993,8 +1002,8 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nx = screen_size_x(s) - ux;
|
if (!cleared && ux < screen_size_x(s)) {
|
||||||
if (!cleared && ux < tty->sx && nx != 0) {
|
nx = screen_size_x(s) - ux;
|
||||||
tty_default_attributes(tty, wp, 8);
|
tty_default_attributes(tty, wp, 8);
|
||||||
tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
|
tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user