From fc43e3161605eb847146163c136cbe02740aeed1 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 27 Oct 1994 22:36:56 +0000 Subject: [PATCH] Fix scroll bug bringed by vi(1), from phk's flame (I still wait for apologies) --- lib/libcurses/curses.c | 2 +- lib/libcurses/curses.h | 2 +- lib/libcurses/refresh.c | 8 ++++---- lib/libcurses/setterm.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libcurses/curses.c b/lib/libcurses/curses.c index e3081c0f575c..13ee80ee0402 100644 --- a/lib/libcurses/curses.c +++ b/lib/libcurses/curses.c @@ -52,7 +52,7 @@ int __usecs = 0; /* * region (used only if insert/delete * line capabilities absent) */ -char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, PC, +char AM, BS, CA, DA, DB, EO, HC, IN, MI, MS, NC, NS, OS, PC, UL, XB, XN, XT, XS, XX; char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 9e1818385050..f7c7f0f0f566 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -120,7 +120,7 @@ extern int My_term; /* Use Def_term regardless. */ extern char *Def_term; /* Default terminal type. */ /* Termcap capabilities. */ -extern char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, +extern char AM, BS, CA, DA, DB, EO, HC, IN, MI, MS, NC, NS, OS, PC, UL, XB, XN, XT, XS, XX; extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index b6d432b9c31a..4cb87a3a760c 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -744,8 +744,8 @@ scrolln(starts, startw, curs, bot, top) } if (n > 0) { - /* Scroll up the block. */ - if (SF != NULL && top == 0) { + /* Scroll up the screen. */ + if ((!DB && SF != NULL || n == 1) && bot == curscr->maxy - 1 && top == 0) { __mvcur(oy, ox, curscr->maxy - 1, 0, 1); if (n == 1) goto f_nl1; @@ -799,8 +799,8 @@ scrolln(starts, startw, curs, bot, top) * !!! * n < 0 */ - /* Preserve the bottom lines. */ - if (SR != NULL && bot == curscr->maxy - 1) { + /* Scroll down the screen. */ + if (!DA && SR != NULL && bot == curscr->maxy - 1 && top == 0) { __mvcur(oy, ox, 0, 0, 1); if (sr != NULL && -n == 1) goto b_sr1; diff --git a/lib/libcurses/setterm.c b/lib/libcurses/setterm.c index ab84e9db4965..c1da04dc99b1 100644 --- a/lib/libcurses/setterm.c +++ b/lib/libcurses/setterm.c @@ -50,8 +50,8 @@ extern short ospeed; static void zap __P((void)); static char *sflags[] = { - /* am bs da eo hc in mi ms */ - &AM, &BS, &DA, &EO, &HC, &IN, &MI, &MS, + /* am bs da db eo hc in mi ms */ + &AM, &BS, &DA, &DB, &EO, &HC, &IN, &MI, &MS, /* nc ns os ul xb xn xt xs xx */ &NC, &NS, &OS, &UL, &XB, &XN, &XT, &XS, &XX };