changeset 324:ba4cc7ebe311

Twiddling on the backbuffer logic.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 09:49:42 +0300
parents 863e3a26974d
children c086345d176b
files nnchat.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sat Jun 11 09:49:05 2011 +0300
+++ b/nnchat.c	Sat Jun 11 09:49:42 2011 +0300
@@ -420,7 +420,7 @@
 
 void updateMainWin(BOOL force)
 {
-    int y, w, h, offs;
+    int y, w, h, offs, o;
     qringbuf_t *buf;
 
     if (mainWin == NULL || currWin == NULL) return;
@@ -430,15 +430,19 @@
     getmaxyx(mainWin, h, w);
     werase(mainWin);
     
-    offs = buf->size - h - currWin->pos;
+    offs = (int) buf->size;
+    offs -= (h + currWin->pos);
     if (offs < 0)
         offs = 0;
+    o = offs;
 
     for (y = 0; y < h && offs < buf->size; offs++) {
         if (buf->data[offs] != NULL)
             printWin(mainWin, (char *) buf->data[offs]);
         y = getcury(mainWin);
     }
+
+//fprintf(stderr, "pos=%d, offs=%d / %d, buf.size=%d, h=%d, y=%d\n", currWin->pos, o, offs, buf->size, h, y);
     
     currWin->dirty = FALSE;
     wrefresh(mainWin);