Mercurial > hg > nnchat
changeset 331:26097c5b9b71
Change how backbuffer offset is handled.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 Jun 2011 17:02:12 +0300 |
parents | 8e509d6546d3 |
children | f55f8309aa66 |
files | nnchat.c |
diffstat | 1 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/nnchat.c Tue Jun 14 12:59:03 2011 +0300 +++ b/nnchat.c Tue Jun 14 17:02:12 2011 +0300 @@ -1731,18 +1731,12 @@ { int oldPos = currWin->pos; - if (c == KEY_NPAGE) { - if (currWin->pos > -10) - currWin->pos -= 10; - else - currWin->pos = -10; - } - else { - if (currWin->pos < currWin->data->n - 10) - currWin->pos += 10; - else - currWin->pos = currWin->data->n - 10; - } + currWin->pos += (c == KEY_NPAGE) ? -10 : +10; + + if (currWin->pos < 0) + currWin->pos = 0; + else if (currWin->pos >= currWin->data->n - 10) + currWin->pos = currWin->data->n - 10; if (oldPos != currWin->pos) updateMain = TRUE;