From f52c2004b818ac739ec886d5ff0a87734b55d293 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 5 Mar 2023 12:31:30 +0000 Subject: win32: changes to console mode handling Add the environment variable BB_TERMINAL_MODE as a more general way of controlling console/terminal mode setting. The default remains unchanged: use virtual terminal mode for output if possible but fall back to the console API with emulated ANSI escape sequences. Currently valid settings are: 0 Force use of console mode 1 Force use of virtual terminal mode for output 5 Prefer virtual terminal mode for output, fall back to console Other values won't do anything useful until code elsewhere has been updated. BB_SKIP_ANSI_EMULATION remains available for backwards compatibility. If both variables are set BB_TERMINAL_MODE takes precedence. --- shell/ash.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 742067216..d78c6e828 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2340,9 +2340,9 @@ static void change_realtime(const char *) FAST_FUNC; #if ENABLE_PLATFORM_MINGW32 static void FAST_FUNC -change_skip_ansi(const char *newval UNUSED_PARAM) +change_terminal_mode(const char *newval UNUSED_PARAM) { - skip_ansi_emulation(TRUE); + terminal_mode(TRUE); } # define LINENO_INDEX (5 + 2 * ENABLE_ASH_MAIL + ENABLE_ASH_GETOPTS) @@ -2387,7 +2387,8 @@ static const struct { { VSTRFIXED|VTEXTFIXED|VUNSET, "HISTFILE" , NULL }, #endif #if ENABLE_PLATFORM_MINGW32 - { VSTRFIXED|VTEXTFIXED|VUNSET, BB_SKIP_ANSI_EMULATION, change_skip_ansi }, + { VSTRFIXED|VTEXTFIXED|VUNSET, BB_SKIP_ANSI_EMULATION, change_terminal_mode }, + { VSTRFIXED|VTEXTFIXED|VUNSET, BB_TERMINAL_MODE, change_terminal_mode }, #endif }; @@ -14603,7 +14604,7 @@ cmdloop(int top) inter++; chkmail(); #if ENABLE_PLATFORM_MINGW32 - skip_ansi_emulation(TRUE); + terminal_mode(TRUE); #endif } n = parsecmd(inter); -- cgit v1.2.3-55-g6feb