fix gratuitous extra line of scrolling (from sdcsvax!laman)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 21 Jul 1984 02:48:00 +0000 (18:48 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 21 Jul 1984 02:48:00 +0000 (18:48 -0800)
SCCS-vsn: lib/libcurses/scroll.c 1.4

usr/src/lib/libcurses/scroll.c

index eba7a4b..70ed04a 100644 (file)
@@ -3,7 +3,7 @@
 /*
  *     This routine scrolls the window up a line.
  *
 /*
  *     This routine scrolls the window up a line.
  *
- * %G% (Berkeley) @(#)scroll.c 1.3
+ * %G% (Berkeley) @(#)scroll.c 1.4
  */
 scroll(win)
 reg WINDOW     *win; {
  */
 scroll(win)
 reg WINDOW     *win; {
@@ -20,19 +20,22 @@ reg WINDOW  *win; {
        for (sp = temp; sp < &temp[win->_maxx]; )
                *sp++ = ' ';
        win->_y[win->_maxy - 1] = temp;
        for (sp = temp; sp < &temp[win->_maxx]; )
                *sp++ = ' ';
        win->_y[win->_maxy - 1] = temp;
-       win->_cury--;
        if (win == curscr) {
                putchar('\n');
                if (!NONL)
                        win->_curx = 0;
 # ifdef DEBUG
                fprintf(outf, "SCROLL: win == curscr\n");
        if (win == curscr) {
                putchar('\n');
                if (!NONL)
                        win->_curx = 0;
 # ifdef DEBUG
                fprintf(outf, "SCROLL: win == curscr\n");
+               fflush(outf);
 # endif
 # endif
-       }
+       } else {
+               if(win->_cury-- <= 0)
+                       win->_cury = 0;
 # ifdef DEBUG
 # ifdef DEBUG
-       else
                fprintf(outf, "SCROLL: win [0%o] != curscr [0%o]\n",win,curscr);
                fprintf(outf, "SCROLL: win [0%o] != curscr [0%o]\n",win,curscr);
+               fflush(outf);
 # endif
 # endif
+       }
        touchwin(win);
        return OK;
 }
        touchwin(win);
        return OK;
 }