diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-10 18:15:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-10 18:15:30 +0000 |
commit | 99cc0015f89698a8e988fa52d51e5959759bf80f (patch) | |
tree | 562c066e6cd36e98f085d90bb5bf7a9c5d4c4409 /screen.c | |
parent | f1ce95915c612ef3b429dc7d2f635b5758b27669 (diff) |
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.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -363,15 +363,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); } |