- if (nvis < nvismax) {
- } else if (!tt.tt_noscroll && row1x == 0 && row2x == wwnrow && dir > 0)
- {
- /*
- * We're going to assume that a line feed at the
- * bottom of the screen will cause a scroll, unless
- * "ns" is set. This should work at least 99%
- * of the time. At any rate, vi seems to do it.
- */
- if (tt.tt_row != wwnrow - 1)
- (*tt.tt_move)(wwnrow - 1, 0);
- ttputc('\n');
- deleted++;
- } else if (tt.tt_delline && tt.tt_insline) {
- /*
- * Don't worry about retain when scrolling down,
- * but do worry when scrolling up, for hp2621.
- */
- if (dir > 0) {
- (*tt.tt_move)(row1x, 0);
- (*tt.tt_delline)();
- if (row2x < wwnrow) {
- (*tt.tt_move)(row2x - 1, 0);
- (*tt.tt_insline)();
- }
- } else {
- if (tt.tt_retain || row2x != wwnrow) {
- (*tt.tt_move)(row2x - 1, 0);
- (*tt.tt_delline)();
- }
- (*tt.tt_move)(row1x, 0);
- (*tt.tt_insline)();
- }
- deleted++;
- }
+ if (nvis < nvismax / 2)
+ goto no_scroll; /* not worth it */
+ if ((dir > 0 ? tt.tt_scroll_down == 0 : tt.tt_scroll_up == 0) ||
+ (tt.tt_scroll_top != row1x || tt.tt_scroll_bot != row2x - 1) &&
+ tt.tt_setscroll == 0)
+ if (tt.tt_delline == 0 || tt.tt_insline == 0)
+ goto no_scroll;
+ xxscroll(dir, row1x, row2x);
+ scrolled = 1;