aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-02-19 10:05:18 +0000
committerRon Yorston <rmy@pobox.com>2023-02-19 10:05:18 +0000
commiteefae06bd0dc1e10c166155afab4b115439bc802 (patch)
tree49cc27d9b0f3b73d0b6a4626a81d661752f4bdd5
parent11ad814fa34287f297671297bd89bf93bcb2ee7b (diff)
downloadbusybox-w32-eefae06bd0dc1e10c166155afab4b115439bc802.tar.gz
busybox-w32-eefae06bd0dc1e10c166155afab4b115439bc802.tar.bz2
busybox-w32-eefae06bd0dc1e10c166155afab4b115439bc802.zip
win32: work around problem with ConEmu
When running the busybox-w32 shell in ConEmu, if: - ANSI emulation is disabled (which it will be, by default) - a non-builtin command is run there is a window of a few seconds after the command completes during which ConEmu is in XTerm mode. During this time any attempt to use the arrows keys will result in [A[B[C[D appearing. This appears to be a common problem: https://github.com/Maximus5/ConEmu/issues/2316 Try to detect if we're running under ConEmu and alter the default behaviour to prefer ANSI emulation. The user can override this preference by setting BB_SKIP_ANSI_EMULATION if desired. By a quirk of fate, old MSYS2 programs (from 2021) which required a workaround in busybox-w32 (commit 54d2ea4b4) are immune to the problem with ConEmu. (GitHib issue #287)
-rw-r--r--win32/winansi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 27559e3f5..1400ea3bb 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -77,7 +77,9 @@ int skip_ansi_emulation(int reset)
77 77
78 if (skip < 0 || reset) { 78 if (skip < 0 || reset) {
79 const char *var = getenv(BB_SKIP_ANSI_EMULATION); 79 const char *var = getenv(BB_SKIP_ANSI_EMULATION);
80 int dflt = is_wine() ? 0 : CONFIG_SKIP_ANSI_EMULATION_DEFAULT; 80 int dflt = CONFIG_SKIP_ANSI_EMULATION_DEFAULT;
81 if (is_wine() || getenv("CONEMUPID") != NULL)
82 dflt = 0;
81 skip = var == NULL ? dflt : atoi(var); 83 skip = var == NULL ? dflt : atoi(var);
82 if (skip < 0 || skip > 2) 84 if (skip < 0 || skip > 2)
83 skip = 0; 85 skip = 0;