-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo can't determine the terminal width on MSYS terminals #5124
Comments
cc @BurntSushi, you wouldn't know how to do this would you? |
Sadly, no idea. The tty hack is about as far as my knowledge of MSYS goes. :-( |
Ah well, worth a shot! I made an attempt here but it turns out although |
I took a little look at this. Due to the way Cygwin/msys handles the console, it can be quite difficult to get the correct information. Opening "CONOUT$" with let h = winapi::um::fileapi::CreateFileA("CONOUT$\0".as_ptr() as *const CHAR,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
ptr::null_mut(),
OPEN_EXISTING,
0,
ptr::null_mut()
); And then you can use that handle with One workaround would be to use ANSI escape sequences to communicate with the terminal (something like "\x1b7\x1b[r\x1b[999;999H\x1b[6n\x1b8"). However, that seems kinda gross to me and doesn't work very well. Ugh. |
Ah thanks for looking into this @ehuss! It may be the case that we could just detect a tty and assume 80 columns as well |
That sounds reasonable to me! |
This solution exists in nightly dist ? |
Unfortunately, no. I can take another look at a solution. |
This is an alternate approach to determining the window size that works on more Windows terminals. Terminals with accurate width detection: Normal Windows console, cmder, ConEmu, VS Code, Hyper, etc. mintty-based terminals will always be 60 characters wide. Cygwin in a command console is ok, but running under x-windows will also always be 60. Tested on Windows 8 and Windows 10. Closes rust-lang#5124.
Get window size on more Windows terminals. This is an alternate approach to determining the window size that works on more Windows terminals. Terminals with accurate width detection: Normal Windows console, cmder, ConEmu, VS Code, Hyper, etc. mintty-based terminals will always be 60 characters wide. Cygwin in a command console is ok, but running under x-windows will also always be 60. Tested on Windows 8 and Windows 10. Closes #5124.
I'm not really sure what the API is to do this, but because Cargo can't determine the width here it doesn't print out fancy progress bars which is sad!
The text was updated successfully, but these errors were encountered: