Extra diagnostics in the hope that we can track down the problem with
[sgt/putty] / terminal.c
index 731bc1f..0d5398e 100644 (file)
@@ -350,6 +350,9 @@ void term_size(int newrows, int newcols, int newsavelines) {
     alt_t = marg_t = 0;
     alt_b = marg_b = newrows - 1;
 
+    debug(("term_size, old r,c,s (%d,%d,%d), new rcs (%d,%d,%d)\n",
+           rows, cols, savelines, newrows, newcols, newsavelines));
+
     if (rows == -1) {
        scrollback = newtree234(NULL);
        screen = newtree234(NULL);
@@ -377,22 +380,31 @@ void term_size(int newrows, int newcols, int newsavelines) {
      *    away.
      */
     sblen = count234(scrollback);
+    debug(("newrows=%d rows=%d sblen=%d\n", newrows, rows, sblen));
     if (newrows > rows) {
        for (i = rows; i < newrows; i++) {
+            debug(("increase screen: i=%d\n", i));
            if (sblen > 0) {
+                debug(("sblen=%d so use line from scrollback\n", sblen));
                line = delpos234(scrollback, --sblen);
            } else {
+                debug(("sblen=%d so make up a new line\n", sblen));
                line = smalloc(TSIZE * (newcols+2));
                line[0] = newcols;
                for (j = 0; j <= newcols; j++)
                    line[j+1] = ERASE_CHAR;
            }
+            debug(("got new screen line %p\n", line));
            addpos234(screen, line, 0);
        }
     } else if (newrows < rows) {
        for (i = newrows; i < rows; i++) {
+            debug(("decrease screen: i=%d\n", i));
            line = delpos234(screen, 0);
+            debug(("taken out line %p, count is now %d\n",
+                   line, count234(screen)));
            addpos234(scrollback, line, sblen++);
+            debug(("added to scrollback, sblen is now %d\n", sblen));
        }
     }
     assert(count234(screen) == newrows);
@@ -906,7 +918,7 @@ void term_out(void) {
                     * t seconds ago.
                     */
                    while (beephead &&
-                          beephead->ticks < ticks - cfg.bellovl_t*1000) {
+                          beephead->ticks < ticks - cfg.bellovl_t) {
                        struct beeptime *tmp = beephead;
                        beephead = tmp->next;
                        sfree(tmp);
@@ -916,7 +928,7 @@ void term_out(void) {
                    }
 
                    if (cfg.bellovl && beep_overloaded &&
-                       ticks-lastbeep >= cfg.bellovl_s * 1000) {
+                       ticks-lastbeep >= cfg.bellovl_s) {
                        /*
                         * If we're currently overloaded and the
                         * last beep was more than s seconds ago,