Open lazycoder-ru opened 6 years ago
@chrisant996
Im sorry, spoke too soon :/ After further testing it seems i can reproduce it even without Clink after all, dont know how i missed it yesterday :(. Even removing the prompt changes nothing.
Funny enough doing the same in the ConEmu->Debug->RealConsole
window does not exhibit the behavior.
Im gonna have to chalk it up to my ancient windows version...
But il dump all the relevant info below just in case.
Windows 10 1511. ConEmu 230724 (Stable). Clink v1.5.4.6f56dd.
The task:
cmd -new_console:n:C:"C:\Projects\cmd_exe_16x16.ico" /k "%ConEmuBaseDir%\CmdInit_Lean.cmd"
Im sidestepping CmdInit.cmd
with my own CmdInit_Lean.cmd
:
prompt $E[32m$E]9;8;"USERNAME"$E\@$E]9;8;"COMPUTERNAME"$E\$S$E[92m$P$E[90m$_$$$E[m$S$E]9;12$E\
"%ConEmuBaseDir%\clink\clink_x64.exe" inject
So since im injecting clink manually, it is disabled in the ConEmu settings. And i checked that Clink is not set to autorun.
Decoded RealConsole modes from the statusbar (0x1b8,0x07):
input mode:
ENABLE_INSERT_MODE
ENABLE_MOUSE_INPUT
ENABLE_WINDOW_INPUT
output mode:
ENABLE_PROCESSED_OUTPUT
ENABLE_WRAP_AT_EOL_OUTPUT
ENABLE_VIRTUAL_TERMINAL_PROCESSING
They never change.
clink.log, from a fresh console running find
and pressing up and enter
19a4 start_logger 160 ---- 2023/09/03 10:19:36.124 -------------------------------------------------
19a4 start_logger 166 Host process is 'cmd.exe' (pid 6564)
19a4 start_logger 170 DLL path is 'C:\Program Files\ConEmu\ConEmu\clink'
19a4 start_logger 185 Windows version 10.0.10586 (x64)
19a4 start_logger 187 Clink version 1.5.4.6f56dd (x64)
19a4 hook_setter::hook_setter 159 >>> Started hook transaction.
19a4 hook_setter::attach_iat 316 Attempting to hook SetEnvironmentVariableW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-2-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8378 (value is 00007FFD9AA3A3F0).
19a4 hook_setter::attach_iat 316 Attempting to hook WriteConsoleW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l1-1-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8010 (value is 00007FFD9AA0C360).
19a4 hook_setter::attach_iat 316 Attempting to hook GetEnvironmentVariableW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-2-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8350 (value is 00007FFD9A9FC580).
19a4 hook_setter::commit 207 <<< Hook transaction committed.
19a4 hook_setter::hook_setter 159 >>> Started hook transaction.
19a4 hook_setter::detach_iat 359 Attempting to unhook 00007FFD6608BC80 from GetEnvironmentVariableW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-2-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8350 (value is 00007FFD6608BC80).
19a4 hook_setter::commit 207 <<< Hook transaction committed.
19a4 hook_setter::hook_setter 159 >>> Started hook transaction.
19a4 hook_setter::attach_iat 316 Attempting to hook ReadConsoleW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l1-1-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8038 (value is 00007FFD9A9E6AA0).
19a4 hook_setter::commit 207 <<< Hook transaction committed.
19a4 hook_setter::hook_setter 159 >>> Started hook transaction.
19a4 hook_setter::attach_iat 316 Attempting to hook SetConsoleTitleW in IAT for module 00007FF7077B0000.
19a4 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l2-1-0.dll'
19a4 find_iat 124 Found import at 00007FF7077D8078 (value is 00007FFD9AA4E800).
19a4 hook_setter::commit 207 <<< Hook transaction committed.
19a4 win_screen_buffer::begin 366 Using native terminal support (auto mode found 'ConEmuHk64.dll').
19a4 LOGCURSORPOS 471 CURSORPOS 0,2
19a4 terminal_log_write 871 RL_OUTSTREAM "[?12l[?25h", 12
19a4 load_user_inputrc 1818 Found Readline inputrc at 'C:\Users\grable\.inputrc'
19a4 host_lua::load_scripts 158 Loaded 1 Lua scripts in 0 ms
19a4 ={update.lua} 0 Clink updater: too soon to check for updates (1693555327 vs 1693729176).
19a4 history_db::initialise 1264 master bank ctag: |CTAG_1693084509_44832578_6892_0
19a4 history_db::compact 1526 History: 9463 active, 929 deleted
19a4 rl_module::rl_module 2315 terminal size 140 x 42
19a4 LOGCURSORPOS 471 CURSORPOS 0,5
19a4 terminal_log_write 871 RL_OUTSTREAM "[?12l[?25h", 12
19a4 LOGCURSORPOS 471 CURSORPOS 0,5
19a4 terminal_log_write 871 RL_OUTSTREAM "[32mgrable@GRABLE-DESKTOP [92mC:\[90m
$[m ]9;12\[m[3G", 63
19a4 rl_module::on_input 2838 INPUT "f", 1
19a4 LOGCURSORPOS 471 CURSORPOS 2,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;38;5;203mf[m", 17
19a4 LOGCURSORPOS 471 CURSORPOS 3,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;90;49mfmpeg -version[m[4G", 31
19a4 LOGCURSORPOS 471 CURSORPOS 3,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[3G[0;1;38;5;33mf[m", 22
19a4 rl_module::on_input 2838 INPUT "i", 1
19a4 LOGCURSORPOS 471 CURSORPOS 3,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[3G[0;38;5;203mfi[m [5G", 39
19a4 LOGCURSORPOS 471 CURSORPOS 4,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;90;49mnd /?[m[5G", 22
19a4 rl_module::on_input 2838 INPUT "n", 1
19a4 LOGCURSORPOS 471 CURSORPOS 4,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;38;5;203mn[m", 17
19a4 rl_module::on_input 2838 INPUT "d", 1
19a4 LOGCURSORPOS 471 CURSORPOS 5,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;38;5;203md[m", 17
19a4 LOGCURSORPOS 471 CURSORPOS 6,6
19a4 terminal_log_write 871 RL_OUTSTREAM "[3G[0;1;38;5;33mfind[m", 25
19a4 rl_module::on_input 2838 INPUT "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 6,6
19a4 terminal_log_write 871 RL_OUTSTREAM " [7G", 7
19a4 LOGCURSORPOS 471 CURSORPOS 6,6
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,7
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,7
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,7
19a4 terminal_log_write 871 RL_OUTSTREAM "[K", 3
19a4 LOGCURSORPOS 471 CURSORPOS 0,7
19a4 terminal_log_write 871 RL_OUTSTREAM "[A", 3
19a4 LOGCURSORPOS 471 CURSORPOS 0,6
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 history_db::compact 1526 History: 9460 active, 932 deleted
19a4 LOGCURSORPOS 471 CURSORPOS 0,9
19a4 terminal_log_write 871 RL_OUTSTREAM "[?12l[?25h", 12
19a4 LOGCURSORPOS 471 CURSORPOS 0,9
19a4 terminal_log_write 871 RL_OUTSTREAM "[32mgrable@GRABLE-DESKTOP [92mC:\[90m
$[m ]9;12\[m[3G", 63
19a4 rl_module::on_input 2838 INPUT "", 1
19a4 rl_module::on_input 2838 INPUT "[", 1
19a4 rl_module::on_input 2838 INPUT "2", 1
19a4 rl_module::on_input 2838 INPUT "7", 1
19a4 rl_module::on_input 2838 INPUT ";", 1
19a4 rl_module::on_input 2838 INPUT "2", 1
19a4 rl_module::on_input 2838 INPUT "7", 1
19a4 rl_module::on_input 2838 INPUT "~", 1
19a4 rl_module::on_input 2838 INPUT "[", 1
19a4 LOGCURSORPOS 471 CURSORPOS 2,10
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;38;5;214m[[0;38;5;203mA[m", 31
19a4 rl_module::on_input 2838 INPUT "", 1
19a4 rl_module::on_input 2838 INPUT "[", 1
19a4 rl_module::on_input 2838 INPUT "2", 1
19a4 rl_module::on_input 2838 INPUT "7", 1
19a4 rl_module::on_input 2838 INPUT ";", 1
19a4 rl_module::on_input 2838 INPUT "2", 1
19a4 rl_module::on_input 2838 INPUT "7", 1
19a4 rl_module::on_input 2838 INPUT "~", 1
19a4 LOGCURSORPOS 471 CURSORPOS 4,10
19a4 terminal_log_write 871 RL_OUTSTREAM "[3G [3G", 10
19a4 rl_module::on_input 2838 INPUT "[", 1
19a4 LOGCURSORPOS 471 CURSORPOS 2,10
19a4 terminal_log_write 871 RL_OUTSTREAM "[0;38;5;214m[[0;38;5;203mA[m", 31
19a4 rl_module::on_input 2838 INPUT "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 4,10
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,11
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,11
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 LOGCURSORPOS 471 CURSORPOS 0,11
19a4 terminal_log_write 871 RL_OUTSTREAM "[K", 3
19a4 LOGCURSORPOS 471 CURSORPOS 0,11
19a4 terminal_log_write 871 RL_OUTSTREAM "[A", 3
19a4 LOGCURSORPOS 471 CURSORPOS 0,10
19a4 terminal_log_write 871 RL_OUTSTREAM "
", 1
19a4 history_db::compact 1526 History: 9459 active, 933 deleted
19a4 LOGCURSORPOS 471 CURSORPOS 0,14
19a4 terminal_log_write 871 RL_OUTSTREAM "[?12l[?25h", 12
19a4 LOGCURSORPOS 471 CURSORPOS 0,14
19a4 terminal_log_write 871 RL_OUTSTREAM "[32mgrable@GRABLE-DESKTOP [92mC:\[90m
$[m ]9;12\[m[3G", 63
@grable0 Thank you for sharing the update, and that Clink isn't the cause. It might be related to your version of Windows, but it might just be a ConEmu issue.
FWIW, it looks like clink set terminal.raw_esc true
will make it so even when ConEmu is in XK mode, Clink will be able to interpret the input. But you'll lose the ability for pressing Esc to clear the input line; the Esc key will instead work how it does in Unix/Linux, with the same quirks about Esc and the same situations where input can get locked up, etc. But adding [$E]9;10;0$E\
](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) to your prompt is the better option.
There is one more thing we can do, if you're interested to get to the bottom of this: We could use Time Travel Debugging to capture a log of what ConEmu does, you could send me the log, and I could analyze it to find precisely why ConEmu is activating XTerm input mode. If you're interested/willing, here is what it would involve:
find
and Enter and Up), then stop the TTD tool.If you're up for that, send an email to the address in my github profile.
P.S. The log file you shared helped me discover a loophole in the input logging in Clink (regression introduced in v1.5.2), where it can miss logging part of the input in some cases. I've updated the logging to fix the loophole.
Versions
ConEmu build: 180626 x64 OS version: Windows 10 x32/x64 Used shell version: bash.exe from WSL(debian)
Problem description
Sometimes arrow keys(and PgUp, PgDn) do not move the cursur, but prints symbols. It appears only with ConEmu, but when I run bash.exe directly from Windows I have no problems.
Steps to reproduce
Actual results
Arrow keys sometimes prints symbols(A,B,C,D).
Expected results
Arrow keys just moving cursor in editor.
Additional files