-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_vadj.c 6.2 10/23/80";
#include "ex.h"
#include "ex_tty.h"
#include "ex_vis.h"
register int d;
register struct vlinfo *vp = &vlinfo[l];
-#ifdef ADEBUG
- if (trace)
- tfixnl(), fprintf(trace, "vreopen(%d, %d, %d)\n", p, lineno, l);
-#endif
d = vp->vdepth;
if (d == 0 || (vp->vflags & VDIRT))
vp->vdepth = d = vdepth();
vgoto(p, 0), vputp(CD, cnt);
vclrech(1);
vadjAL(p, cnt);
- } else if (AL) {
- /*
- * Use insert line.
- */
- vgoto(p, 0), vputp(AL, WECHO + 1 - p);
- for (i = cnt - 1; i > 0; i--) {
- vgoto(outline+1, 0), vputp(AL, WECHO + 1 - outline);
- if ((hold & HOLDAT) == 0)
- putchar('@');
- }
- vadjAL(p, cnt);
- } else if (SR && p == WTOP) {
+ } else if (SR && p == WTOP && costSR < costAL) {
/*
* Use reverse scroll mode of the terminal, at
- * the top of the window.
+ * the top of the window. Reverse linefeed works
+ * too, since we only use it from line WTOP.
*/
for (i = cnt; i > 0; i--) {
vgoto(p, 0), vputp(SR, 0);
vputp(CE, 1);
}
vadjAL(p, cnt);
+ } else if (AL) {
+ /*
+ * Use insert line.
+ */
+ vgoto(p, 0), vputp(AL, WECHO + 1 - p);
+ for (i = cnt - 1; i > 0; i--) {
+ vgoto(outline+1, 0), vputp(AL, WECHO + 1 - outline);
+ if ((hold & HOLDAT) == 0)
+ putchar('@');
+ }
+ vadjAL(p, cnt);
} else
could = 0;
vopenup(cnt, could, l);
cnt = dl - (splitw ? WECHO : WBOT);
if (splitw && (state == VISUAL || state == CRTOPEN))
holdupd = 1;
- vscroll(cnt);
vmoveitup(cnt, 1);
+ vscroll(cnt);
destline = dl - cnt, destcol = dc;
}