commit 81641b410b1170a048a3b6994268ddf78515aad6 from: Mark Jamsek date: Thu Apr 20 11:35:19 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 - 8496bf63db31d4c4e433fa8e5fddf5719038aa32 commit + 81641b410b1170a048a3b6994268ddf78515aad6 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 - 4f544396c2a7e9672cb82f64712cf9b3840d4881 blob + d9961429f19e9acc49150d85407f5f73815a445b --- tog/tog.c +++ tog/tog.c @@ -622,9 +622,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. @@ -1450,9 +1448,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) @@ -1471,7 +1469,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); @@ -1521,7 +1519,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 */ @@ -1655,7 +1653,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; @@ -4205,7 +4203,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");