commit 13bc6832b964af6431e0b8c6c8586405474e3e71 from: Mark Jamsek via: Thomas Adam date: Sat Apr 22 18:10:25 2023 UTC tog regress: zap needless defines and use "vt220" TERM Also, overwrite - and | unconditionally when capturing screen dumps, and unset TOG_COLORS and TOG_DIFF_ALGORITHM in regress setup. All tweaks suggested by naddy@ ok stsp@ commit - 1134ebde7e9791e46cbbb9356aa0abf4617125da commit + 13bc6832b964af6431e0b8c6c8586405474e3e71 blob - e03be4c0dcc342c5c4bee7432c3f25219682d085 blob + 5c67c9b6991543475718b5f280e03afe3d39a724 --- regress/tog/common.sh +++ regress/tog/common.sh @@ -17,8 +17,11 @@ . ../cmdline/common.sh +unset TOG_COLORS +unset TOG_DIFF_ALGORITHM unset TOG_VIEW_SPLIT_MODE unset LC_ALL +export TERM=vt220 export LC_ALL=C.UTF-8 export COLUMNS=80 export LINES=24 blob - f28f644c2ffd30e11a5646fd5f92ca54144e5829 blob + 3700f7273b4957614715d370d0453f195ef84da0 --- tog/tog.c +++ tog/tog.c @@ -626,9 +626,7 @@ struct tog_io { } tog_io; static int using_mock_io; -#define TOG_SCREEN_DUMP "SCREENDUMP" -#define TOG_SCREEN_DUMP_LEN (sizeof(TOG_SCREEN_DUMP) - 1) -#define TOG_KEY_SCRDUMP SHRT_MIN +#define TOG_KEY_SCRDUMP SHRT_MIN /* * We implement two types of views: parent views and child views. @@ -1454,9 +1452,9 @@ strip_trailing_ws(char *str, int *n) /* * Extract visible substring of line y from the curses screen - * and strip trailing whitespace. If vline is set and locale is - * UTF-8, overwrite line[vline] with '|' because the ACS_VLINE - * character is written out as 'x'. Write the line to file f. + * and strip trailing whitespace. If vline is set, overwrite + * line[vline] with '|' because the ACS_VLINE character is + * written out as 'x'. Write the line to file f. */ static const struct got_error * view_write_line(FILE *f, int y, int vline) @@ -1475,7 +1473,7 @@ view_write_line(FILE *f, int y, int vline) */ strip_trailing_ws(line, &r); - if (vline > 0 && got_locale_is_utf8()) + if (vline > 0) line[vline] = '|'; w = fprintf(f, "%s\n", line); @@ -1525,7 +1523,7 @@ screendump(struct tog_view *view) view->child->begin_y : view->begin_y; for (i = 0; i < view->lines; i++) { - if (hline && got_locale_is_utf8() && i == hline - 1) { + if (hline && i == hline - 1) { int c; /* ACS_HLINE writes out as 'q', overwrite it */ @@ -1659,7 +1657,7 @@ tog_read_script_key(FILE *script, int *ch, int *done) *ch = KEY_DOWN; else if (strncasecmp(line, "KEY_UP", 6) == 0) *ch = KEY_UP; - else if (strncasecmp(line, TOG_SCREEN_DUMP, TOG_SCREEN_DUMP_LEN) == 0) + else if (strncasecmp(line, "SCREENDUMP", 10) == 0) *ch = TOG_KEY_SCRDUMP; else *ch = *line; @@ -4209,7 +4207,6 @@ init_mock_term(const char *test_script_path) goto done; } - /* use local TERM so we test in different environments */ if (newterm(NULL, tog_io.cout, tog_io.cin) == NULL) err = got_error_msg(GOT_ERR_IO, "newterm: failed to initialise curses");