-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_vput.c 6.1 10/18/80";
#include "ex.h"
#include "ex_tty.h"
#include "ex_vis.h"
* since we don't really know whats out there.
* Vigoto might decide (incorrectly) to do nothing.
*/
- if (DB)
- vgoto(WECHO, 0), vputp(CD ? CD : CE, 1);
- else
- vigoto(WECHO, 0), vclreol();
+ if (DB) {
+ vgoto(WECHO, 0);
+ vputp(CD ? CD : CE, 1);
+ } else {
+ if (XT) {
+ /*
+ * This code basically handles the t1061
+ * where positioning at (0, 0) won't work
+ * because the terminal won't let you put
+ * the cursor on it's magic cookie.
+ *
+ * Should probably be XS above, or even a
+ * new X? glitch, but right now t1061 is the
+ * only terminal with XT.
+ */
+ vgoto(WECHO, 0);
+ vputp(DL, 1);
+ } else {
+ vigoto(WECHO, 0);
+ vclreol();
+ }
+ }
splitw = 0;
didphys = 1;
}
*/
vgotab()
{
- register int i = (LINE(vcline) - destline) * WCOLS + destcol;
+ register int i = tabcol(destcol, value(TABSTOP)) - destcol;
do
(*Outchar)(QUOTE);
- while (++i % value(TABSTOP));
+ while (--i);
}
/*
register int i;
char temp[TUBECOLS];
- if (vtube[p] == cp)
+ if (p < 0 || vtube[p] == cp)
return;
for (i = ZERO; i <= WECHO; i++)
if (vtube[i] == cp) {
* use QUOTE here since we really need to print blanks.
* QUOTE|' ' is the representation of this.
*/
- inssiz = value(TABSTOP) - inscol % value(TABSTOP);
+ inssiz = tabcol(inscol, value(TABSTOP)) - inscol;
c = ' ' | QUOTE;
} else
inssiz = 1;
* line is now deeper. We then do the shift
* implied by the insertion.
*/
- if (inssiz >= doomed + value(TABSTOP) - tabstart % value(TABSTOP)) {
+ if (inssiz >= doomed + tabcol(tabstart, value(TABSTOP)) - tabstart) {
if (IN)
vrigid();
vneedpos(value(TABSTOP));
e = vglitchup(vcline, d);
vigoto(e, 0); vclreol();
if (dosync) {
+ int (*Ooutchar)() = Outchar;
Outchar = vputchar;
vsync(e + 1);
- Outchar = vinschar;
+ Outchar = Ooutchar;
}
} else {
vup1();
goim();
up = tp + j * WCOLS - shft;
i = shft;
- do
- vputchar(*up++);
- while (--i);
+ do {
+ if (*up)
+ vputchar(*up++);
+ else
+ break;
+ } while (--i);
}
vigotoCL(tabstart);
i = shft - (inssiz - doomed);
if (trace)
tracec(c);
#endif
- /* Patch to fix problem of >79 chars on echo line: don't echo extras */
+ /* Fix problem of >79 chars on echo line. */
if (destcol >= WCOLS-1 && splitw && destline == WECHO)
- return;
+ pofix();
if (destcol >= WCOLS) {
destline += destcol / WCOLS;
destcol %= WCOLS;