# HG changeset patch # User Matti Hamalainen # Date 1308060132 -10800 # Node ID 26097c5b9b71aef37a441b854d5a34f8be6113ed # Parent 8e509d6546d3d687494f130c2865165a20d1de88 Change how backbuffer offset is handled. diff -r 8e509d6546d3 -r 26097c5b9b71 nnchat.c --- 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;