aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-01-27 23:04:47 +0000
committerJosh Rahm <rahm@google.com>2023-01-27 23:04:47 +0000
commite64dc03ff7b867826c7fc76d6fff210ad3382e33 (patch)
tree9cf71b02a7ee8f6d39ae1207201dc0745bdb8be5 /screen-write.c
parentfb15fd116097b98c1b839cfdc76a7d84e206e6d5 (diff)
parentf5af3cfb211c12897b15e3b5a3b29c4bbb0493a8 (diff)
downloadrtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.tar.gz
rtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.tar.bz2
rtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/screen-write.c b/screen-write.c
index 213b533c..59d289ec 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1506,7 +1506,8 @@ screen_write_fullredraw(struct screen_write_ctx *ctx)
screen_write_collect_flush(ctx, 0, __func__);
screen_write_initctx(ctx, &ttyctx, 1);
- ttyctx.redraw_cb(&ttyctx);
+ if (ttyctx.redraw_cb != NULL)
+ ttyctx.redraw_cb(&ttyctx);
}
/* Trim collected items. */
@@ -1819,7 +1820,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, cx, cy;
+ u_int width = gc->data.width, xx, last, cy;
int selected, skip = 1;
/* Ignore padding cells. */
@@ -1852,12 +1853,12 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ctx->flags &= ~SCREEN_WRITE_ZWJ;
screen_write_collect_flush(ctx, 0, __func__);
if ((gc = screen_write_combine(ctx, ud, &xx)) != NULL) {
- cx = s->cx; cy = s->cy;
+ cy = s->cy;
screen_write_set_cursor(ctx, xx, s->cy);
screen_write_initctx(ctx, &ttyctx, 0);
ttyctx.cell = gc;
tty_write(tty_cmd_cell, &ttyctx);
- s->cx = cx; s->cy = cy;
+ s->cx = xx + 1 + gc->data.width; s->cy = cy;
}
return;
}
@@ -2015,6 +2016,14 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct utf8_data *ud,
memcpy(gc.data.data + gc.data.size, ud->data, ud->size);
gc.data.size += ud->size;
+ /* If this is U+FE0F VARIATION SELECTOR-16, force the width to 2. */
+ if (gc.data.width == 1 &&
+ ud->size == 3 &&
+ memcmp(ud->data, "\357\270\217", 3) == 0) {
+ grid_view_set_padding(gd, (*xx) + 1, s->cy);
+ gc.data.width = 2;
+ }
+
/* Set the new cell. */
grid_view_set_cell(gd, *xx, s->cy, &gc);
@@ -2100,13 +2109,15 @@ screen_write_setselection(struct screen_write_ctx *ctx, const char *flags,
/* Write unmodified string. */
void
-screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len)
+screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len,
+ int allow_invisible_panes)
{
struct tty_ctx ttyctx;
screen_write_initctx(ctx, &ttyctx, 0);
ttyctx.ptr = str;
ttyctx.num = len;
+ ttyctx.allow_invisible_panes = allow_invisible_panes;
tty_write(tty_cmd_rawstring, &ttyctx);
}
@@ -2126,7 +2137,8 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
screen_alternate_on(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);
- ttyctx.redraw_cb(&ttyctx);
+ if (ttyctx.redraw_cb != NULL)
+ ttyctx.redraw_cb(&ttyctx);
}
/* Turn alternate screen off. */
@@ -2144,5 +2156,6 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
screen_alternate_off(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);
- ttyctx.redraw_cb(&ttyctx);
+ if (ttyctx.redraw_cb != NULL)
+ ttyctx.redraw_cb(&ttyctx);
}