aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-03-07 15:32:28 +0000
committerThomas Adam <thomas@xteddy.org>2017-03-07 15:32:28 +0000
commit5d3296c53b820664d50d96b2b926f2c2c1105e97 (patch)
tree6662d3cc05fc87f840157fdac6cd489817b2e1c0
parent69257bc0aa8b5fbafb459f8e46985a97f840da63 (diff)
parent1e6e606f54537c732cce48e5d3eae7fc29281fe5 (diff)
downloadrtmux-5d3296c53b820664d50d96b2b926f2c2c1105e97.tar.gz
rtmux-5d3296c53b820664d50d96b2b926f2c2c1105e97.tar.bz2
rtmux-5d3296c53b820664d50d96b2b926f2c2c1105e97.zip
Merge branch 'obsd-master'
-rw-r--r--grid.c2
-rw-r--r--screen-write.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/grid.c b/grid.c
index 0fde6f62..424d272a 100644
--- a/grid.c
+++ b/grid.c
@@ -553,6 +553,8 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx,
grid_expand_line(gd, py, dx + nx, 8);
memmove(&gl->celldata[dx], &gl->celldata[px],
nx * sizeof *gl->celldata);
+ if (dx + nx > gl->cellused)
+ gl->cellused = dx + nx;
/* Wipe any cells that have been moved. */
for (xx = px; xx < px + nx; xx++) {
diff --git a/screen-write.c b/screen-write.c
index d9d37437..1af3b32f 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1030,8 +1030,9 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only)
{
struct screen *s = ctx->s;
struct screen_write_collect_item *ci, *tmp;
- u_int y, cx, cy;
+ u_int y, cx, cy, items = 0;
struct tty_ctx ttyctx;
+ size_t written = 0;
if (ctx->scrolled != 0) {
log_debug("%s: scrolled %u (region %u-%u)", __func__,
@@ -1056,13 +1057,18 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only)
ttyctx.ptr = ci->data;
ttyctx.num = ci->used;
tty_write(tty_cmd_cells, &ttyctx);
- ctx->written += ci->used;
+
+ items++;
+ written += ci->used;
TAILQ_REMOVE(&ctx->list[y].items, ci, entry);
free(ci);
}
}
s->cx = cx; s->cy = cy;
+
+ log_debug("%s: flushed %u items (%zu bytes)", __func__, items, written);
+ ctx->written += written;
}
/* Finish and store collected cells. */
@@ -1101,9 +1107,9 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
/*
* Don't need to check that the attributes and whatnot are still the
- * same - input_parse will do a flush when anything that isn't a plain
- * character is encountered. Also nothing should make it here that
- * isn't a single ASCII character.
+ * same - input_parse will end the collection when anything that isn't
+ * a plain character is encountered. Also nothing should make it here
+ * that isn't a single ASCII character.
*/
collect = 1;
@@ -1119,6 +1125,7 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
collect = 0;
if (!collect) {
screen_write_collect_end(ctx);
+ screen_write_collect_flush(ctx, 0);
screen_write_cell(ctx, gc);
return;
}