-
Notifications
You must be signed in to change notification settings - Fork 10
Make sticky messages work better on windows #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So, I think the most reasonable first attempt would be synchronous write that bypasses |
Excellent, thanks for sharing that context. I've got a windows 10 VM handy, I'll see what I can do. |
Ok, it seems like simply bypassing libuv is not enough. It appears that Julia's modified libuv is preventing this from working at a deeper level by talking to the windows console API. A snippet like the following starts to make things somewhat-work, though I'm not sure what the other consequences of this hacking are. const BOOL = Cint
const DWORD = Culong
const LPDWORD = Ptr{DWORD}
const HANDLE = Ptr{Cvoid}
function fix_console_mode()
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
STD_OUTPUT_HANDLE = reinterpret(DWORD, Int32(-11))
hConsole = ccall(:GetStdHandle, HANDLE, (DWORD,), STD_OUTPUT_HANDLE)
consoleMode = Ref{DWORD}(0);
ccall(:GetConsoleMode, BOOL, (HANDLE, LPDWORD), hConsole, consoleMode)
ccall(:SetConsoleMode, BOOL, (HANDLE, DWORD), hConsole,
consoleMode[] | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
end This is based on @musm's code at |
Thanks a lot for looking into this. It's unfortunate that this is not going to be an easy hack... By the way, option 1 may not be so bad in the sense that it can also be used as a workaround for #22; i.e., a |
Hmm. We could try to call Calling Alternatively maybe we just need to call whatever console API can be used to simulate the scroll region (DECSTBM from VT100). There's |
Should be fixed in julia now 😄 |
I don't really know the full main issue here but I do think it's probably fixed on the nightly builds. Would be great to check and confirm! |
What are the main things to look at for this issue? I'd like to use these sticky messages for progress bars, so I went ahead and removed the And did some tests with a simple The updating in place part worked at both julia versions I tried. Now I see that commits bumping libuv were backported to 1.5.3, so that is nice. In cmd.exe if I manually scroll around during a progress bar things can get a little funky, on both julia versions: But this does not happen in my Alacritty shell (I can't test on Windows Terminal unfortunately). Is this good enough to remove the |
@visr Agreed, this is fixed as long as you use a modern terminal aka Windows Terminal. |
Sounds great 👍 |
This now works due to new libuv patches landing in recent julia versions. Fixes JuliaLogging#28
Bump. Would #37 need more testing to get it merged and new version to be tagged? I have tested https://diffeq.sciml.ai/stable/features/progress_bar/#Using-Progress-Bars-Outside-Juno on Win10 REPL using Julia v1.5.3, v1.6.0-beta1.0 and Windows Terminal and default cmd.exe prompt. Seems to work well for DiffEq progress bar purposes. |
This now works due to new libuv patches landing in recent julia versions. Fixes #28
Now that people have started using this package, we're seeing that some unfortunate workarounds are required. For example, the
iswindows
check here: https://github.com/JuliaDiffEq/DiffEqBase.jl/pull/454/files.There seem to be a few options:
ConsoleProgressMonitor
does which makes it work ok-ish on windowswrite
hack which would bypass libuv and allow us to set the terminal scroll region on windows, regardless of libuv's attempt to intercept?The text was updated successfully, but these errors were encountered: