aboutsummaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-21 16:12:10 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-21 16:12:10 +0000
commit9b7e18f166b1f771a2ad3096831bf145731deb1b (patch)
treefb26b2b9eea8e65461f6089af7e33030493da255 /screen.c
parent180faf73afe07d35e6002993a70d5fe63549ffce (diff)
downloadrtmux-9b7e18f166b1f771a2ad3096831bf145731deb1b.tar.gz
rtmux-9b7e18f166b1f771a2ad3096831bf145731deb1b.tar.bz2
rtmux-9b7e18f166b1f771a2ad3096831bf145731deb1b.zip
Rework reflow code so it does not do so much allocation which should be
faster with large histories.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/screen.c b/screen.c
index 1c0c0d36..754effc2 100644
--- a/screen.c
+++ b/screen.c
@@ -362,15 +362,10 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
/* Reflow wrapped lines. */
void
-screen_reflow(struct screen *s, u_int sx)
+screen_reflow(struct screen *s, u_int new_x)
{
- struct grid *old, *new;
+ struct grid *old = s->grid;
- old = s->grid;
- new = grid_create(old->sx, old->sy, old->hlimit);
-
- s->cy -= grid_reflow(new, old, sx);
- s->grid = new;
-
- grid_destroy(old);
+ s->grid = grid_create(old->sx, old->sy, old->hlimit);
+ s->cy -= grid_reflow(s->grid, old, new_x);
}