diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-20 19:14:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-20 19:14:42 +0000 |
commit | 1501b3fbbdf405aae7dc996a60bd22a49c884110 (patch) | |
tree | 9031656cc31c7b68ef378ea28b923ceca4833f56 /screen-write.c | |
parent | 234ad54b2c7b1b1b9a78d3ecc20d29c12dd2f107 (diff) | |
download | rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.tar.gz rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.tar.bz2 rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.zip |
A few trivial optimisations: no need to check for zero size if calling
buffer_ensure in buffer.c; expand grid lines by a greater increase than one
each time; and don't read UTF-8 data unless it actually needs to be checked
when overwriting a cell.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/screen-write.c b/screen-write.c index d735d450..dd553f17 100644 --- a/screen-write.c +++ b/screen-write.c @@ -858,7 +858,8 @@ screen_write_overwrite(struct screen_write_ctx *ctx) u_int xx; gc = grid_view_peek_cell(gd, s->cx, s->cy); - gu = grid_view_peek_utf8(gd, s->cx, s->cy); + if (gc->flags & GRID_FLAG_UTF8) + gu = grid_view_peek_utf8(gd, s->cx, s->cy); if (gc->flags & GRID_FLAG_PADDING) { /* @@ -885,16 +886,19 @@ screen_write_overwrite(struct screen_write_ctx *ctx) break; grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); } - } else if (gc->flags & GRID_FLAG_UTF8 && gu->width > 1) { - /* - * An UTF-8 wide cell; overwrite following padding cells only. - */ - xx = s->cx; - while (++xx < screen_size_x(s)) { - gc = grid_view_peek_cell(gd, xx, s->cy); - if (!(gc->flags & GRID_FLAG_PADDING)) - break; - grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); + } else if (gc->flags & GRID_FLAG_UTF8) { + gu = grid_view_peek_utf8(gd, s->cx, s->cy); + if (gu->width > 1) { + /* + * An UTF-8 wide cell; overwrite following padding cells only. + */ + xx = s->cx; + while (++xx < screen_size_x(s)) { + gc = grid_view_peek_cell(gd, xx, s->cy); + if (!(gc->flags & GRID_FLAG_PADDING)) + break; + grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); + } } } } |