|
Andreas Schneider |
0cd513 |
From aeda2e5808af7c4b629dce23d2b4331a77ecde83 Mon Sep 17 00:00:00 2001
|
|
Andreas Schneider |
0cd513 |
From: nicm <nicm>
|
|
Andreas Schneider |
0cd513 |
Date: Wed, 15 Nov 2017 19:18:57 +0000
|
|
Andreas Schneider |
0cd513 |
Subject: [PATCH] If there is a double width character at the very end of the
|
|
Andreas Schneider |
0cd513 |
line with not enough room to draw it, just leave it out.
|
|
Andreas Schneider |
0cd513 |
|
|
Andreas Schneider |
0cd513 |
---
|
|
Andreas Schneider |
0cd513 |
tty.c | 23 ++++++++++++++++-------
|
|
Andreas Schneider |
0cd513 |
1 file changed, 16 insertions(+), 7 deletions(-)
|
|
Andreas Schneider |
0cd513 |
|
|
Andreas Schneider |
0cd513 |
diff --git a/tty.c b/tty.c
|
|
Andreas Schneider |
0cd513 |
index 90361e3fb..0dee5008e 100644
|
|
Andreas Schneider |
0cd513 |
--- a/tty.c
|
|
Andreas Schneider |
0cd513 |
+++ b/tty.c
|
|
Andreas Schneider |
0cd513 |
@@ -882,6 +882,7 @@ void
|
|
Andreas Schneider |
0cd513 |
tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
struct screen *s, u_int py, u_int ox, u_int oy)
|
|
Andreas Schneider |
0cd513 |
{
|
|
Andreas Schneider |
0cd513 |
+ struct grid *gd = s->grid;
|
|
Andreas Schneider |
0cd513 |
struct grid_cell gc, last;
|
|
Andreas Schneider |
0cd513 |
u_int i, j, ux, sx, nx, width;
|
|
Andreas Schneider |
0cd513 |
int flags, cleared = 0;
|
|
Andreas Schneider |
0cd513 |
@@ -900,15 +901,15 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
* there may be empty background cells after it (from BCE).
|
|
Andreas Schneider |
0cd513 |
*/
|
|
Andreas Schneider |
0cd513 |
sx = screen_size_x(s);
|
|
Andreas Schneider |
0cd513 |
- if (sx > s->grid->linedata[s->grid->hsize + py].cellsize)
|
|
Andreas Schneider |
0cd513 |
- sx = s->grid->linedata[s->grid->hsize + py].cellsize;
|
|
Andreas Schneider |
0cd513 |
+ if (sx > gd->linedata[gd->hsize + py].cellsize)
|
|
Andreas Schneider |
0cd513 |
+ sx = gd->linedata[gd->hsize + py].cellsize;
|
|
Andreas Schneider |
0cd513 |
if (sx > tty->sx)
|
|
Andreas Schneider |
0cd513 |
sx = tty->sx;
|
|
Andreas Schneider |
0cd513 |
ux = 0;
|
|
Andreas Schneider |
0cd513 |
|
|
Andreas Schneider |
0cd513 |
if (wp == NULL ||
|
|
Andreas Schneider |
0cd513 |
py == 0 ||
|
|
Andreas Schneider |
0cd513 |
- (~s->grid->linedata[s->grid->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
|
|
Andreas Schneider |
0cd513 |
+ (~gd->linedata[gd->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
|
|
Andreas Schneider |
0cd513 |
ox != 0 ||
|
|
Andreas Schneider |
0cd513 |
tty->cx < tty->sx ||
|
|
Andreas Schneider |
0cd513 |
screen_size_x(s) < tty->sx) {
|
|
Andreas Schneider |
0cd513 |
@@ -932,7 +933,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
width = 0;
|
|
Andreas Schneider |
0cd513 |
|
|
Andreas Schneider |
0cd513 |
for (i = 0; i < sx; i++) {
|
|
Andreas Schneider |
0cd513 |
- grid_view_get_cell(s->grid, i, py, &gc);
|
|
Andreas Schneider |
0cd513 |
+ grid_view_get_cell(gd, i, py, &gc);
|
|
Andreas Schneider |
0cd513 |
if (len != 0 &&
|
|
Andreas Schneider |
0cd513 |
(((~tty->flags & TTY_UTF8) &&
|
|
Andreas Schneider |
0cd513 |
(gc.data.size != 1 ||
|
|
Andreas Schneider |
0cd513 |
@@ -943,6 +944,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
gc.attr != last.attr ||
|
|
Andreas Schneider |
0cd513 |
gc.fg != last.fg ||
|
|
Andreas Schneider |
0cd513 |
gc.bg != last.bg ||
|
|
Andreas Schneider |
0cd513 |
+ ux + width + gc.data.width >= screen_size_x(s) ||
|
|
Andreas Schneider |
0cd513 |
(sizeof buf) - len < gc.data.size)) {
|
|
Andreas Schneider |
0cd513 |
tty_attributes(tty, &last, wp);
|
|
Andreas Schneider |
0cd513 |
tty_putn(tty, buf, len, width);
|
|
Andreas Schneider |
0cd513 |
@@ -956,7 +958,14 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
screen_select_cell(s, &last, &gc);
|
|
Andreas Schneider |
0cd513 |
else
|
|
Andreas Schneider |
0cd513 |
memcpy(&last, &gc, sizeof last);
|
|
Andreas Schneider |
0cd513 |
- if (((~tty->flags & TTY_UTF8) &&
|
|
Andreas Schneider |
0cd513 |
+ if (ux + gc.data.width > screen_size_x(s))
|
|
Andreas Schneider |
0cd513 |
+ for (j = 0; j < gc.data.width; j++) {
|
|
Andreas Schneider |
0cd513 |
+ if (ux + j > screen_size_x(s))
|
|
Andreas Schneider |
0cd513 |
+ break;
|
|
Andreas Schneider |
0cd513 |
+ tty_putc(tty, ' ');
|
|
Andreas Schneider |
0cd513 |
+ ux++;
|
|
Andreas Schneider |
0cd513 |
+ }
|
|
Andreas Schneider |
0cd513 |
+ else if (((~tty->flags & TTY_UTF8) &&
|
|
Andreas Schneider |
0cd513 |
(gc.data.size != 1 ||
|
|
Andreas Schneider |
0cd513 |
*gc.data.data >= 0x7f ||
|
|
Andreas Schneider |
0cd513 |
gc.data.width != 1)) ||
|
|
Andreas Schneider |
0cd513 |
@@ -993,8 +1002,8 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
|
|
Andreas Schneider |
0cd513 |
}
|
|
Andreas Schneider |
0cd513 |
}
|
|
Andreas Schneider |
0cd513 |
|
|
Andreas Schneider |
0cd513 |
- nx = screen_size_x(s) - ux;
|
|
Andreas Schneider |
0cd513 |
- if (!cleared && ux < tty->sx && nx != 0) {
|
|
Andreas Schneider |
0cd513 |
+ if (!cleared && ux < screen_size_x(s)) {
|
|
Andreas Schneider |
0cd513 |
+ nx = screen_size_x(s) - ux;
|
|
Andreas Schneider |
0cd513 |
tty_default_attributes(tty, wp, 8);
|
|
Andreas Schneider |
0cd513 |
tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
|
|
Andreas Schneider |
0cd513 |
}
|