Skip to content

Conversation

KristofferC
Copy link
Member

Should fix #53763. Making a PR so I can test the build.

Written with Claude 🤖

@KristofferC KristofferC requested a review from topolarity October 9, 2025 13:30
@KristofferC KristofferC force-pushed the kc/virtual_terminal_input branch 2 times, most recently from 90f1ed3 to 0c7b6fa Compare October 9, 2025 13:41
@KristofferC KristofferC force-pushed the kc/virtual_terminal_input branch from 0c7b6fa to acaa94a Compare October 9, 2025 13:42
@KristofferC
Copy link
Member Author

cc @mkitti, @digital-carver

@topolarity
Copy link
Member

This does not seem to improve pasting "julia> 5+5" for me - this PR behaves as before.

In fact, I haven't been able to find any behavioral difference in Windows Terminal w/ this PR - including what I believe are bracketed paste sequences. I might be missing a test case, of course.

@topolarity
Copy link
Member

Looks like something is still resetting the console mode:

julia> enable_virtual_terminal_input(); get_input_console_mode()
0x00000207

julia> get_input_console_mode()
0x00000007

@topolarity
Copy link
Member

topolarity commented Oct 10, 2025

Reset is happening in:

#0  0x00007ffce1842388 in SetConsoleMode () from /cygdrive/c/windows/System32/KERNELBASE.dll
#1  0x00007ffc3e08c6fe in uv_tty_set_mode (tty=0x274e1de20a0, mode=UV_TTY_MODE_RAW) at src/win/tty.c:373
#2  0x00007ffbe10cde5e in julia_raw!_54128 () at Terminals.jl:139
#3  0x00007ffbe0f67aa7 in jfptr_rawNOT._54129 () from /home/cody/repos/julia/usr/lib/julia/sys.dll
#4  0x00007ffbdfa116d0 in julia_prompt!_16968 (term=0x7ffbe9ade710 <jl_system_image_data+135186192>, prompt=...,
    s=...) at C:\cygwin64\home\cody\repos\julia\usr\share\julia\stdlib\v1.13\REPL\src/LineEdit.jl:2966
#5  0x00007ffbdfafc957 in julia_run_interface_16965 (terminal=0x7ffbe9ade710 <jl_system_image_data+135186192>,
    m=..., s=...) at C:\cygwin64\home\cody\repos\julia\usr\share\julia\stdlib\v1.13\REPL\src/LineEdit.jl:2875
#6  0x00007ffbdfa9fa63 in julia_run_frontend_16934 (repl=..., backend=...)
    at C:\cygwin64\home\cody\repos\julia\usr\share\julia\stdlib\v1.13\REPL\src/REPL.jl:1696
#7  0x00007ffbdfb13be9 in julia_#61_16931 ()
    at C:\cygwin64\home\cody\repos\julia\usr\share\julia\stdlib\v1.13\REPL\src/REPL.jl:677
#8  0x00007ffbdfa22211 in jfptr_YY.61_16932 ()
   from /home/cody/repos/julia/usr/share/julia/compiled/v1.13/REPL/u0gqU_M6pBl.dll
#9  0x00007ffc3df99ffa in jl_apply (nargs=1, args=0x8221dfdbb8) at /home/cody/repos/julia/src/julia.h:2275
#10 start_task () at /home/cody/repos/julia/src/task.c:1281
#11 0x0000000000000000 in ?? ()

https://github.com/libuv/libuv/blob/f3ce527ea940d926c40878ba5de219640c362811/src/win/tty.c#L385-L398

Looks like we may want UV_TTY_MODE_RAW_VT but we'd need a libuv update: libuv/libuv@843b64f

@mkitti
Copy link
Contributor

mkitti commented Oct 10, 2025

Ah yes, I recall mentioning that in #53763

Something seems to keep resetting the input console mode. The following calls lead to SetConsoleMode.

  • uv_tty_set_mode calls SetConsoleMode.
  • [jl_uv_flush_close_callback] (
    uv_tty_set_mode((uv_tty_t*)stream, UV_TTY_MODE_NORMAL);
    ) calls uv_tty_set_mode
  • init_stdio_handle calls uv_tty_set_mode
  • jl_tty_set_mode calls uv_tty_set_mode

@KristofferC
Copy link
Member Author

Yeah, that's why I put this in refresh_line so it would get reapplied but maybe the order of things don't work out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bracketed Paste Mode is not enabled on Windows

3 participants