reflow: fix backscroll expansion when full

This commit is contained in:
Boris Faure 2013-03-20 22:50:16 +01:00
parent 18c8aff57c
commit b605913b1d
1 changed files with 11 additions and 3 deletions

View File

@ -512,7 +512,7 @@ _termpty_horizontally_expand(Termpty *ty, int old_w, int old_h,
Termsave *ts; Termsave *ts;
if (ty->backscroll_num == ty->backmax - 1) if (ty->backscroll_num == ty->backmax - 1)
ts = ty->back[(ty->backpos + i) % ty->backscroll_num]; ts = ty->back[(ty->backpos + i) % ty->backmax];
else else
ts = ty->back[i]; ts = ty->back[i];
if (!ts) if (!ts)
@ -592,8 +592,16 @@ _termpty_horizontally_expand(Termpty *ty, int old_w, int old_h,
} }
} }
ty->backscroll_num = new_back_pos; if (new_back_pos >= ty->backmax)
ty->backpos = new_back_pos; {
ty->backscroll_num = ty->backmax - 1;
ty->backpos = 0;
}
else
{
ty->backscroll_num = new_back_pos;
ty->backpos = new_back_pos;
}
free(ty->back); free(ty->back);
ty->back = new_back; ty->back = new_back;