diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-03-06 10:01:21 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-03-06 10:01:21 +0000 |
commit | 69257bc0aa8b5fbafb459f8e46985a97f840da63 (patch) | |
tree | 9c53ef26dae1a338df879462abfd93df6941b562 | |
parent | 8684e60f51050cf48e76d9f9e488dc56e2250723 (diff) | |
parent | dc8fefe902279836958c7438718e838d3687aed2 (diff) | |
download | rtmux-69257bc0aa8b5fbafb459f8e46985a97f840da63.tar.gz rtmux-69257bc0aa8b5fbafb459f8e46985a97f840da63.tar.bz2 rtmux-69257bc0aa8b5fbafb459f8e46985a97f840da63.zip |
Merge branch 'obsd-master'
-rw-r--r-- | screen-write.c | 4 | ||||
-rw-r--r-- | tty.c | 21 |
2 files changed, 20 insertions, 5 deletions
diff --git a/screen-write.c b/screen-write.c index 937870f9..d9d37437 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1151,7 +1151,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) struct grid_cell tmp_gc, now_gc; struct tty_ctx ttyctx; u_int sx = screen_size_x(s), sy = screen_size_y(s); - u_int width = gc->data.width, xx, last; + u_int width = gc->data.width, xx, last, cx, cy; int selected, skip = 1; /* Ignore padding cells. */ @@ -1163,10 +1163,12 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) if (width == 0) { screen_write_collect_flush(ctx, 0); if ((gc = screen_write_combine(ctx, &gc->data, &xx)) != 0) { + cx = s->cx; cy = s->cy; screen_write_cursormove(ctx, xx, s->cy); screen_write_initctx(ctx, &ttyctx); ttyctx.cell = gc; tty_write(tty_cmd_cell, &ttyctx); + s->cx = cx; s->cy = cy; } return; } @@ -709,7 +709,11 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp, for (i = 0; i < sx; i++) { grid_view_get_cell(s->grid, i, py, &gc); if (len != 0 && - (gc.attr & GRID_ATTR_CHARSET || + (((~tty->flags & TTY_UTF8) && + (gc.data.size != 1 || + *gc.data.data >= 0x7f || + gc.data.width != 1)) || + (gc.attr & GRID_ATTR_CHARSET) || gc.flags != last.flags || gc.attr != last.attr || gc.fg != last.fg || @@ -726,10 +730,19 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp, screen_select_cell(s, &last, &gc); else memcpy(&last, &gc, sizeof last); - if (gc.attr & GRID_ATTR_CHARSET) { + if (((~tty->flags & TTY_UTF8) && + (gc.data.size != 1 || + *gc.data.data >= 0x7f || + gc.data.width != 1)) || + (gc.attr & GRID_ATTR_CHARSET)) { tty_attributes(tty, &last, wp); - for (j = 0; j < gc.data.size; j++) - tty_putc(tty, gc.data.data[j]); + if (~tty->flags & TTY_UTF8) { + for (j = 0; j < gc.data.width; j++) + tty_putc(tty, '_'); + } else { + for (j = 0; j < gc.data.size; j++) + tty_putc(tty, gc.data.data[j]); + } } else { memcpy(buf + len, gc.data.data, gc.data.size); len += gc.data.size; |