/* * VT200 and up * * Test to ensure that 'ech' (erase character) is honored, with no parameter, * explicit parameter, and longer than the screen width (to ensure that the * terminal doesn't try to wrap-around the erasure). */ static int tst_ECH(MENU_ARGS) { int i; int last = max_lines - 4; decaln(); for (i = 1; i <= max_lines; i++) { cup(i, min_cols - i - 2); do_csi("X"); /* make sure default-parameter works */ cup(i, min_cols - i - 1); printf("*"); ech(min_cols); printf("*"); /* this should be adjacent, in the upper-right corner */ } vt_move(last, 1); vt_clear(0); vt_move(last, min_cols - (last + 10)); println("diagonal: ^^ (clear)"); println("ECH test: there should be E's with a gap before diagonal of **'s"); println("The lower-right diagonal region should be cleared. Nothing else."); return MENU_HOLD; }
/* * Clear around the box for fancy_bce_test(). */ static void fancy_bce_erases(BOX *box) { int i; int first; int limit; cup(box->top - 1, min_cols / 2); ed(1); /* clear from home to cursor */ cuf(1); el(0); /* clear from cursor to end of line */ cup(box->bottom + 1, min_cols / 2); ed(0); /* clear from cursor to end */ cub(1); el(1); /* clear to beginning of line */ for (i = box->top; i <= box->bottom; i++) { cup(i, box->left - 1); el(1); cup(i, box->right + 1); limit = min_cols - box->right; first = i + 1 - box->top; if (first > limit) first = limit; dch(first); limit -= first; if (limit > 0) ech(limit); } }
Abp desc(Abp a, Nat x) { while(v(a,x) > v(a,imin(a,x))) { ech(a,x,imin(a,x)); x = imin(a,x); } return a; }
Abp spo(Abp a, Nat x) { if(x >= n(a)) return a; a = ech(a,x,n(a)-1); a = s(a); if(v(a,x) < v(a,imont(x))) a = mont(a,x); else if(v(a,x) > v(a,imin(a,x))) a = desc(a,x); return a; }