/* * Scroll the box up/down to check if the colors are being shifted in. */ static void fancy_bce_shifts(BOX *box) { int i; int limit = box->top - 1; decsclm(TRUE); /* slow it down a little */ cup(1, 1); for (i = 0; i < limit; ++i) dl(1); for (i = 0; i < limit; ++i) ri(); decsclm(FALSE); }
int bug_d(MENU_ARGS) { int i; char result; /* Make the bug appear */ do { cup(14, 1); /* The original code in the article says * PRINT ESC$; "[13;1H"; CHR$(10%); * but I guess a cup(14,1); would do. * (To output a pure LF might be tricky). */ deccolm(TRUE); /* Make the bug visible */ cup(1, 9); decdwl(); println("You should see blinking text at the bottom line."); cup(3, 9); decdwl(); println("Enter 0 to exit, 1 to try to invoke the bug again."); cup(max_lines, 9); decdwl(); sgr("1;5;7"); printf("If you can see this then the bug did not appear."); sgr(""); cup(4, 9); decdwl(); result = inchar(); readnl(); deccolm(FALSE); } while (result == '1'); decsclm(TRUE); /* Syrup scroll */ cup(max_lines - 1, 1); for (i = 1; i <= 5; i++) println("If the bug is present, this should make things much worse!"); holdit(); decsclm(FALSE); /* Jump scroll */ return MENU_NOHOLD; }
/* Scrolling test (used also in color-testing) */ void do_scrolling(void) { int soft, first, last, down, i, pass; ed(2); decom(TRUE); /* Origin mode (relative) */ for (soft = -1; soft <= 0; soft++) { if (soft) decsclm(TRUE); else decsclm(FALSE); for (pass = 0; pass < 2; ++pass) { if (pass == 0) { first = max_lines / 2; last = first + 1; } else { first = 1; last = max_lines; } decstbm(first, last); ed(2); for (down = 0; down >= -1; down--) { if (down) cuu(max_lines); else cud(max_lines); for (i = 1; i <= max_lines + 5; i++) { printf("%s scroll %s region [%d..%d] size %d Line %d\n", soft ? "Soft" : "Jump", down ? "down" : "up", first, last, last - first + 1, i); if (down) { ri(); ri(); } else if (soft) extra_padding(10); } } holdit(); } } }
int bug_a(MENU_ARGS) { int i; cup(10, 1); println("This is a test of the VT100 'Scroll while toggle softscroll'"); println("bug. The cursor may disappear, or move UP the screen, or"); println("multiple copies of some lines may appear."); holdit(); /* Invoke the bug */ esc("[24H"); /* Simplified cursor movement */ decsclm(FALSE); for (i = 1; i <= 20; i++) printf("\n"); decsclm(TRUE); for (i = 1; i <= 10; i++) printf("\n"); decsclm(FALSE); for (i = 1; i <= 5; i++) printf("\n"); /* That should be enough to show the bug. But we'll try another way: */ decsclm(TRUE); /* Set soft scroll */ nel(); /* "NextLine", move down */ decsclm(FALSE); /* Reset soft scroll */ nel(); /* "NextLine", move down */ for (i = 1; i <= 10; i++) { /* Show the bug */ printf("Softscroll bug test, line %d. ", i); holdit(); } println("That should have been enough to show the bug, if present."); return MENU_HOLD; }
/* Set up my personal prejudices */ int setup_terminal(MENU_ARGS) { if (LOG_ENABLED) fprintf(log_fp, "Setup Terminal with test-defaults\n"); default_level(); /* Enter ANSI mode (if in VT52 mode) */ decckm(FALSE); /* cursor keys normal */ deccolm(FALSE); /* 80 col mode */ decsclm(FALSE); /* Jump scroll */ decscnm(FALSE); /* Normal screen */ decom(FALSE); /* Absolute origin mode */ decawm(TRUE); /* Wrap around on */ decarm(FALSE); /* Auto repeat off */ sm("?40"); /* Enable 80/132 switch (xterm) */ rm("?45"); /* Disable reverse wrap (xterm) */ decstbm(0, 0); /* No scroll region */ sgr("0"); /* Normal character attributes */ return MENU_NOHOLD; }