/* * Clear to the end of the current physical line */ void vclreol(void) { register int i; register char *tp; if (destcol == VCOLUMNS) return; destline += destcol / VCOLUMNS; destcol %= VCOLUMNS; #ifdef DEBUG if (destline < 0 || destline > TUBELINES) error("Internal error: vclreol@- please tell someone"); #endif i = VCOLUMNS - destcol; tp = vtube[destline] + destcol; if (*tp == 0) return; if (CE) { vcsync(); vputs(CE); vclrbyte(tp, i); return; } while (i > 0 && *tp != 0) { vputchar(' '); --i, tp++; } }
/* * Clear the entire (physical and logical) screen */ void vclear(void) { vputs(CLEAR); destcol = 0; outcol = 0; destline = 0; outline = 0; vclrbyte(vtube0, LINES * COLUMNS); }
/* * Deal with the screen, clearing, cursor positioning, putting characters * into the screen image, and deleting characters. * Really hard stuff here is utilizing insert character operations * on intelligent terminals which differs widely from terminal to terminal. */ void vclear(void) { #ifdef TRACE if (trace) tfixnl(), fprintf(trace, "------\nvclear, clear_screen '%s'\n", clear_screen); #endif tputs(clear_screen, lines, putch); destcol = 0; outcol = 0; destline = 0; outline = 0; if (inopen) vclrbyte(vtube0, WCOLS * (WECHO - ZERO + 1)); }
/* * Can we hack an open/visual on this terminal? * If so, then divide the screen buffer up into lines, * and initialize a bunch of state variables before we start. */ static void vok(char *atube) { register int i; if (WCOLS == 1000) serror("Don't know enough about your terminal to use %s", Command); if (WCOLS > TUBECOLS) error("Terminal too wide"); if (WLINES >= TUBELINES || WCOLS * (WECHO - ZERO + 1) > TUBESIZE) error("Screen too large"); vtube0 = atube; vclrbyte(atube, WCOLS * (WECHO - ZERO + 1)); for (i = 0; i < ZERO; i++) vtube[i] = (char *) 0; for (; i <= WECHO; i++) vtube[i] = atube, atube += WCOLS; for (; i < TUBELINES; i++) vtube[i] = (char *) 0; vutmp = atube; vundkind = VNONE; vUNDdot = 0; OCOLUMNS = COLUMNS; inopen = 1; #ifdef CBREAK signal(SIGINT, vintr); #endif vmoving = 0; splitw = 0; doomed = 0; holdupd = 0; Peekkey = 0; vcnt = vcline = 0; if (vSCROLL == 0) vSCROLL = (value(WINDOW)+1)/2; /* round up so dft=6,11 */ }
/* * Clear to the end of the current physical line */ void vclreol(void) { int i; wchar_t *tp, j; #ifdef TRACE if (trace) fprintf(trace, "vclreol(), destcol %d, ateopr() %d\n", destcol, ateopr()); #endif if (destcol == WCOLS) return; destline += destcol / WCOLS; destcol %= WCOLS; if (destline < 0 || destline > WECHO) error(gettext("Internal error: vclreol")); i = WCOLS - destcol; tp = vtube[destline] + destcol; if (clr_eol) { if (insert_null_glitch && *tp || !ateopr()) { vcsync(); vputp(clr_eol, 1); } vclrbyte(tp, i); return; } if (*tp == 0) return; while (i > 0 && (j = *tp & (QUOTE|TRIM))) { if (j != ' ' && (j & QUOTE) == 0) { destcol = WCOLS - i; (void) vputchar(' '); } --i, *tp++ = 0; } }