aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-21 21:09:13 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-21 21:09:13 +0000
commit4b883524d8da98b2f00e83437cc06bd65228fc5b (patch)
tree3ef96ab68b0aeae68b7cc7ad0a3d0d178ff6758f /screen-write.c
parent15556ad0d67f3c1345fc4d462ab2949816ca7849 (diff)
downloadrtmux-4b883524d8da98b2f00e83437cc06bd65228fc5b.tar.gz
rtmux-4b883524d8da98b2f00e83437cc06bd65228fc5b.tar.bz2
rtmux-4b883524d8da98b2f00e83437cc06bd65228fc5b.zip
Sync OpenBSD patchset 282:
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.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/screen-write.c b/screen-write.c
index bdb624a1..93fc7446 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.68 2009-08-14 21:32:38 tcunha Exp $ */
+/* $Id: screen-write.c,v 1.69 2009-08-21 21:09:13 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
+ }
}
}
}