static char sccsid
[] = "@(#)wwscroll.c 3.15 %G%";
* Copyright (c) 1983 Regents of the University of California,
* All rights reserved. Redistribution permitted subject to
* the terms of the Berkeley Software License Agreement.
else if (top
+ w
->ww_b
.nr
< w
->ww_w
.b
)
top
= w
->ww_w
.b
- w
->ww_b
.nr
;
n
= abs(top
- w
->ww_b
.t
);
(void) wwscroll1(w
, w
->ww_i
.t
, w
->ww_i
.b
, dir
, 0);
w
->ww_buf
-= top
- w
->ww_b
.t
;
w
->ww_b
.b
= top
+ w
->ww_b
.nr
;
* Scroll one line, between 'row1' and 'row2', in direction 'dir'.
* Don't adjust ww_scroll.
* And don't redraw 'leaveit' lines.
wwscroll1(w
, row1
, row2
, dir
, leaveit
)
* See how many lines on the screen are affected.
* And calculate row1x, row2x, and left at the same time.
for (i
= row1
; i
< row2
&& w
->ww_nvis
[i
] == 0; i
++)
if (i
>= row2
) /* can't do any fancy stuff */
for (i
= row2
- 1; i
>= row1
&& w
->ww_nvis
[i
] == 0; i
--)
goto out
; /* just one line is easy */
* See how much of this window is visible.
nvismax
= wwncol
* (row2x
- row1x
);
for (i
= row1x
; i
< row2x
; i
++)
* If it's a good idea to use delete and insert line
* and the terminal can, then do it.
if (nvis
> nvismax
/ 2 && tt
.tt_delline
&& tt
.tt_insline
) {
register union ww_char
*tmp
;
register union ww_char
**cpp
, **cqq
;
* Don't worry about retain when scrolling down,
* but do worry when scrolling up, for hp2621.
* 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_noscroll
|| row1x
!= 0 || row2x
!= wwnrow
) {
(*tt
.tt_move
)(row2x
- 1, 0);
if (tt
.tt_row
!= wwnrow
- 1)
(*tt
.tt_move
)(wwnrow
- 1, 0);
for (i
= row2x
- row1x
; --i
> 0;)
if (tt
.tt_retain
|| row2x
!= wwnrow
) {
(*tt
.tt_move
)(row2x
- 1, 0);
for (i
= row2x
- row1x
; --i
> 0;)
for (i
= wwncol
; --i
>= 0;)
register union ww_char
*tmp
;
register union ww_char
**cpp
, **cqq
;
for (i
= row2x
- row1x
; --i
> 0;)
for (i
= row2x
- row1x
; --i
> 0;)
for (i
= row2x
- row1x
; --i
>= 0;)
*p
++ |= WWU_MAJOR
|WWU_TOUCHED
;
wwredrawwin1(w
, row1
, row1x
, dir
);
wwredrawwin1(w
, row2x
- 1, row2
- leaveit
, dir
);
register union ww_char
*tmp
;
register union ww_char
**cpp
, **cqq
;
for (i
= row2x
- row1x
; --i
> 0;)
for (i
= row2x
- row1x
; --i
> 0;)
*q
|= WWU_MAJOR
|WWU_TOUCHED
;
for (i
= row2x
- row1x
; --i
>= 0;)
wwredrawwin1(w
, row1
+ leaveit
, row1x
+ 1, dir
);
wwredrawwin1(w
, row2x
, row2
, dir
);
wwredrawwin1(w
, row1
, row2
- leaveit
, dir
);
wwredrawwin1(w
, row1
+ leaveit
, row2
, dir
);