diff options
author | Thomas Adam <thomas@xteddy.org> | 2016-06-06 10:01:11 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2016-06-06 10:01:11 +0100 |
commit | cc096ae9291c35887679c7031c24cac218ddc319 (patch) | |
tree | b2cfe5c70312723a6fe91d22660b00ba71a69d74 /screen-write.c | |
parent | 1f75c98f4999856ddb6a5d620b6dd1ed18b6324d (diff) | |
parent | aba44380137b5d78f9033e46b5dc4a4f3ef1012a (diff) | |
download | rtmux-cc096ae9291c35887679c7031c24cac218ddc319.tar.gz rtmux-cc096ae9291c35887679c7031c24cac218ddc319.tar.bz2 rtmux-cc096ae9291c35887679c7031c24cac218ddc319.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/screen-write.c b/screen-write.c index 0341f0ad..48af1383 100644 --- a/screen-write.c +++ b/screen-write.c @@ -989,8 +989,19 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) if (skip) skip = (memcmp(&now_gc, gc, sizeof now_gc) == 0); - /* Set the cell. */ - if (!skip) + /* Update the selection the flag and set the cell. */ + selected = screen_check_selection(s, s->cx, s->cy); + if (selected && ~gc->flags & GRID_FLAG_SELECTED) { + skip = 0; + memcpy(&tmp_gc, gc, sizeof tmp_gc); + tmp_gc.flags |= GRID_FLAG_SELECTED; + grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc); + } else if (!selected && gc->flags & GRID_FLAG_SELECTED) { + skip = 0; + memcpy(&tmp_gc, gc, sizeof tmp_gc); + tmp_gc.flags &= ~GRID_FLAG_SELECTED; + grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc); + } else if (!skip) grid_view_set_cell(gd, s->cx, s->cy, gc); /* @@ -1009,11 +1020,6 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) tty_write(tty_cmd_insertcharacter, &ttyctx); } - /* Check if this is selected. */ - selected = screen_check_selection(s, s->cx - width, s->cy); - if (selected) - skip = 0; - /* Save last cell if it will be needed. */ if (!skip && ctx->wp != NULL && ttyctx.ocx > ctx->wp->sx - width) screen_write_save_last(ctx, &ttyctx); |