=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- src/usr.bin/tmux/screen.c 2012/07/10 11:53:01 1.23 +++ src/usr.bin/tmux/screen.c 2013/02/05 11:08:59 1.24 @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.23 2012/07/10 11:53:01 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.24 2013/02/05 11:08:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -120,7 +120,7 @@ /* Resize screen. */ void -screen_resize(struct screen *s, u_int sx, u_int sy) +screen_resize(struct screen *s, u_int sx, u_int sy, int reflow) { if (sx < 1) sx = 1; @@ -140,6 +140,9 @@ if (sy != screen_size_y(s)) screen_resize_y(s, sy); + + if (reflow) + screen_reflow(s, sx); } void @@ -355,4 +358,19 @@ } return (1); +} + +/* Reflow wrapped lines. */ +void +screen_reflow(struct screen *s, u_int sx) +{ + struct grid *old, *new; + + 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); }