version 1.51, 2023/04/17 09:49:04 |
version 1.52, 2023/04/21 13:39:37 |
|
|
}; |
}; |
|
|
void vtmove(int, int); |
void vtmove(int, int); |
void vtputc(int); |
void vtputc(int, struct mgwin *); |
void vtpute(int); |
void vtpute(int, struct mgwin *); |
int vtputs(const char *); |
int vtputs(const char *, struct mgwin *); |
void vteeol(void); |
void vteeol(void); |
void updext(int, int); |
void updext(int, int); |
void modeline(struct mgwin *, int); |
void modeline(struct mgwin *, int); |
|
|
* Three guesses how we found this. |
* Three guesses how we found this. |
*/ |
*/ |
void |
void |
vtputc(int c) |
vtputc(int c, struct mgwin *wp) |
{ |
{ |
struct video *vp; |
struct video *vp; |
|
int target; |
|
|
c &= 0xff; |
c &= 0xff; |
|
|
|
|
if (vtcol >= ncol) |
if (vtcol >= ncol) |
vp->v_text[ncol - 1] = '$'; |
vp->v_text[ncol - 1] = '$'; |
else if (c == '\t') { |
else if (c == '\t') { |
|
target = ntabstop(vtcol, wp->w_bufp->b_tabw); |
do { |
do { |
vtputc(' '); |
vtputc(' ', wp); |
} while (vtcol < ncol && (vtcol & 0x07) != 0); |
} while (vtcol < ncol && vtcol < target); |
} else if (ISCTRL(c)) { |
} else if (ISCTRL(c)) { |
vtputc('^'); |
vtputc('^', wp); |
vtputc(CCHR(c)); |
vtputc(CCHR(c), wp); |
} else if (isprint(c)) |
} else if (isprint(c)) |
vp->v_text[vtcol++] = c; |
vp->v_text[vtcol++] = c; |
else { |
else { |
char bf[5]; |
char bf[5]; |
|
|
snprintf(bf, sizeof(bf), "\\%o", c); |
snprintf(bf, sizeof(bf), "\\%o", c); |
vtputs(bf); |
vtputs(bf, wp); |
} |
} |
} |
} |
|
|
|
|
* margin. |
* margin. |
*/ |
*/ |
void |
void |
vtpute(int c) |
vtpute(int c, struct mgwin *wp) |
{ |
{ |
struct video *vp; |
struct video *vp; |
|
int target; |
|
|
c &= 0xff; |
c &= 0xff; |
|
|
|
|
if (vtcol >= ncol) |
if (vtcol >= ncol) |
vp->v_text[ncol - 1] = '$'; |
vp->v_text[ncol - 1] = '$'; |
else if (c == '\t') { |
else if (c == '\t') { |
|
target = ntabstop(vtcol + lbound, wp->w_bufp->b_tabw); |
do { |
do { |
vtpute(' '); |
vtpute(' ', wp); |
} while (((vtcol + lbound) & 0x07) != 0 && vtcol < ncol); |
} while (((vtcol + lbound) < target) && vtcol < ncol); |
} else if (ISCTRL(c) != FALSE) { |
} else if (ISCTRL(c) != FALSE) { |
vtpute('^'); |
vtpute('^', wp); |
vtpute(CCHR(c)); |
vtpute(CCHR(c), wp); |
} else if (isprint(c)) { |
} else if (isprint(c)) { |
if (vtcol >= 0) |
if (vtcol >= 0) |
vp->v_text[vtcol] = c; |
vp->v_text[vtcol] = c; |
|
|
|
|
snprintf(bf, sizeof(bf), "\\%o", c); |
snprintf(bf, sizeof(bf), "\\%o", c); |
for (cp = bf; *cp != '\0'; cp++) |
for (cp = bf; *cp != '\0'; cp++) |
vtpute(*cp); |
vtpute(*cp, wp); |
} |
} |
} |
} |
|
|
|
|
vscreen[i]->v_flag |= (VFCHG | VFHBAD); |
vscreen[i]->v_flag |= (VFCHG | VFHBAD); |
vtmove(i, 0); |
vtmove(i, 0); |
for (j = 0; j < llength(lp); ++j) |
for (j = 0; j < llength(lp); ++j) |
vtputc(lgetc(lp, j)); |
vtputc(lgetc(lp, j), wp); |
vteeol(); |
vteeol(); |
} else if ((wp->w_rflag & (WFEDIT | WFFULL)) != 0) { |
} else if ((wp->w_rflag & (WFEDIT | WFFULL)) != 0) { |
hflag = TRUE; |
hflag = TRUE; |
|
|
vtmove(i, 0); |
vtmove(i, 0); |
if (lp != wp->w_bufp->b_headp) { |
if (lp != wp->w_bufp->b_headp) { |
for (j = 0; j < llength(lp); ++j) |
for (j = 0; j < llength(lp); ++j) |
vtputc(lgetc(lp, j)); |
vtputc(lgetc(lp, j), wp); |
lp = lforw(lp); |
lp = lforw(lp); |
} |
} |
vteeol(); |
vteeol(); |
|
|
while (i < curwp->w_doto) { |
while (i < curwp->w_doto) { |
c = lgetc(lp, i++); |
c = lgetc(lp, i++); |
if (c == '\t') { |
if (c == '\t') { |
curcol |= 0x07; |
curcol = ntabstop(curcol, curwp->w_bufp->b_tabw); |
curcol++; |
|
} else if (ISCTRL(c) != FALSE) |
} else if (ISCTRL(c) != FALSE) |
curcol += 2; |
curcol += 2; |
else if (isprint(c)) |
else if (isprint(c)) |
|
|
(curcol < ncol - 1)) { |
(curcol < ncol - 1)) { |
vtmove(i, 0); |
vtmove(i, 0); |
for (j = 0; j < llength(lp); ++j) |
for (j = 0; j < llength(lp); ++j) |
vtputc(lgetc(lp, j)); |
vtputc(lgetc(lp, j), wp); |
vteeol(); |
vteeol(); |
/* this line no longer is extended */ |
/* this line no longer is extended */ |
vscreen[i]->v_flag &= ~VFEXT; |
vscreen[i]->v_flag &= ~VFEXT; |
|
|
vtmove(currow, -lbound); /* start scanning offscreen */ |
vtmove(currow, -lbound); /* start scanning offscreen */ |
lp = curwp->w_dotp; /* line to output */ |
lp = curwp->w_dotp; /* line to output */ |
for (j = 0; j < llength(lp); ++j) /* until the end-of-line */ |
for (j = 0; j < llength(lp); ++j) /* until the end-of-line */ |
vtpute(lgetc(lp, j)); |
vtpute(lgetc(lp, j), curwp); |
vteeol(); /* truncate the virtual line */ |
vteeol(); /* truncate the virtual line */ |
vscreen[currow]->v_text[0] = '$'; /* and put a '$' in column 1 */ |
vscreen[currow]->v_text[0] = '$'; /* and put a '$' in column 1 */ |
} |
} |
|
|
vscreen[n]->v_flag |= (VFCHG | VFHBAD); /* Recompute, display. */ |
vscreen[n]->v_flag |= (VFCHG | VFHBAD); /* Recompute, display. */ |
vtmove(n, 0); /* Seek to right line. */ |
vtmove(n, 0); /* Seek to right line. */ |
bp = wp->w_bufp; |
bp = wp->w_bufp; |
vtputc('-'); |
vtputc('-', wp); |
vtputc('-'); |
vtputc('-', wp); |
if ((bp->b_flag & BFREADONLY) != 0) { |
if ((bp->b_flag & BFREADONLY) != 0) { |
vtputc('%'); |
vtputc('%', wp); |
if ((bp->b_flag & BFCHG) != 0) |
if ((bp->b_flag & BFCHG) != 0) |
vtputc('*'); |
vtputc('*', wp); |
else |
else |
vtputc('%'); |
vtputc('%', wp); |
} else if ((bp->b_flag & BFCHG) != 0) { /* "*" if changed. */ |
} else if ((bp->b_flag & BFCHG) != 0) { /* "*" if changed. */ |
vtputc('*'); |
vtputc('*', wp); |
vtputc('*'); |
vtputc('*', wp); |
} else { |
} else { |
vtputc('-'); |
vtputc('-', wp); |
vtputc('-'); |
vtputc('-', wp); |
} |
} |
vtputc('-'); |
vtputc('-', wp); |
n = 5; |
n = 5; |
n += vtputs("Mg: "); |
n += vtputs("Mg: ", wp); |
if (bp->b_bname[0] != '\0') |
if (bp->b_bname[0] != '\0') |
n += vtputs(&(bp->b_bname[0])); |
n += vtputs(&(bp->b_bname[0]), wp); |
while (n < 42) { /* Pad out with blanks. */ |
while (n < 42) { /* Pad out with blanks. */ |
vtputc(' '); |
vtputc(' ', wp); |
++n; |
++n; |
} |
} |
vtputc('('); |
vtputc('(', wp); |
++n; |
++n; |
for (md = 0; ; ) { |
for (md = 0; ; ) { |
n += vtputs(bp->b_modes[md]->p_name); |
n += vtputs(bp->b_modes[md]->p_name, wp); |
if (++md > bp->b_nmodes) |
if (++md > bp->b_nmodes) |
break; |
break; |
vtputc('-'); |
vtputc('-', wp); |
++n; |
++n; |
} |
} |
/* XXX These should eventually move to a real mode */ |
/* XXX These should eventually move to a real mode */ |
if (macrodef == TRUE) |
if (macrodef == TRUE) |
n += vtputs("-def"); |
n += vtputs("-def", wp); |
if (globalwd == TRUE) |
if (globalwd == TRUE) |
n += vtputs("-gwd"); |
n += vtputs("-gwd", wp); |
vtputc(')'); |
vtputc(')', wp); |
++n; |
++n; |
|
|
if (linenos && colnos) |
if (linenos && colnos) |
|
|
else if (colnos) |
else if (colnos) |
len = snprintf(sl, sizeof(sl), "--C%d", getcolpos(wp)); |
len = snprintf(sl, sizeof(sl), "--C%d", getcolpos(wp)); |
if ((linenos || colnos) && len < sizeof(sl) && len != -1) |
if ((linenos || colnos) && len < sizeof(sl) && len != -1) |
n += vtputs(sl); |
n += vtputs(sl, wp); |
|
|
while (n < ncol) { /* Pad out. */ |
while (n < ncol) { /* Pad out. */ |
vtputc('-'); |
vtputc('-', wp); |
++n; |
++n; |
} |
} |
} |
} |
|
|
* Output a string to the mode line, report how long it was. |
* Output a string to the mode line, report how long it was. |
*/ |
*/ |
int |
int |
vtputs(const char *s) |
vtputs(const char *s, struct mgwin *wp) |
{ |
{ |
int n = 0; |
int n = 0; |
|
|
while (*s != '\0') { |
while (*s != '\0') { |
vtputc(*s++); |
vtputc(*s++, wp); |
++n; |
++n; |
} |
} |
return (n); |
return (n); |