-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Terminal width seems to be unused, resulting in very small output #955
Comments
Thank you for reporting this! I can not reproduce this with bat 0.15 on iTerm2 3.2. Unfortunately, I can not install iTerm2 3.3.9 in my VirtualBox with MacOS X 10.11.6. Do you happen to know the last version of |
Yes.
|
I'm going to see if git bisect yields anything. |
that would be great. We did not update the |
Oh.. I can actually reproduce this on Linux. I have no idea how I missed this before releasing 0.15. For some reason, I can not reproduce it in debug builds. Weird. |
Now this is just great: actual terminal size: 105 debug build:
release build:
|
It gets better: the binaries on the release page work just fine. They were built in release mode as well. That might explain why I didn't see this when releasing the new version. |
The wrong number that shows up is actually the terminal height instead of the terminal width. debug:
release:
|
Here is the code to get the terminal size (https://github.com/mitsuhiko/console/blob/0ce68cfbbff14391421a481eb8eafcb67c2af9b7/src/unix_term.rs#L22-L38): unsafe {
if libc::isatty(libc::STDOUT_FILENO) != 1 {
return None;
}
let mut winsize: libc::winsize = mem::zeroed();
// FIXME: ".into()" used as a temporary fix for a libc bug
// https://github.com/rust-lang/libc/pull/704
#[allow(clippy::identity_conversion)]
libc::ioctl(libc::STDOUT_FILENO, libc::TIOCGWINSZ.into(), &mut winsize);
if winsize.ws_row > 0 && winsize.ws_col > 0 {
Some((winsize.ws_row as u16, winsize.ws_col as u16))
} else {
None
}
} the only thing I can see is that the return code of |
Uh... the order of the tuple is backwards in release builds? This is going to be a fun one to debug. If there's not a |
I cannot reproduce from the repo. Git bisect gave all good builds :) I did a new install and there it fails, so it might be in the dependencies? Not sure if I should post that list here, since it is quite long. |
For me, Git bisect only gives me bad builds, unless I go back really far in history. |
I did a |
Differences in used crates between the git build and the crates.io build:
|
They definitely changed the implementation in 0.10.1. I forgot that |
Well, I can confirm my terminal had 44 rows :) |
Versioning is hard. |
@eth-p How can I test this using |
@sharkdp I found the commit that changed the terminal size implementation: console-rs/console@d345166 |
Ok, the issue is the following:
we can run |
|
@sharkdp If it's fine with you, I think we should just update to |
Or, alternatively, we can make an upstream issue about the breaking change and see if there are any plans to revert back to the old order? |
But 0.11 is broken, too. This has to be fixed upstream. I will open an issue. |
@sharkdp That would depend on if the change was intentional, though. If it was, we would just have to change the logic on our end. If not, we'll have to wait a 0.11.1 release and update the dependency version. |
There is no release notes, no changelog, so it's hard to tell. Changing the behavior from 0.10.0 to 0.10.1 is clearly a (versioning) bug though. |
Unfortunately, yeah. |
How about changing the version for console to Installing using the above Thanks for looking into this btw. |
I now see the appeal of I now see the appeal #881 😄
done 👍 |
This reverts commit d64c55e. The build on Windows failed due to two broken tests: line_numbers tabs_numbers
What version of
bat
are you using?bat 0.15.0
Describe the bug you encountered:
bat is no longer recognising the terminal width on iTerm2 3.3.9.
It seems like it is using 44 as the width, while my terminal is wider than 200 characters.
Describe what you expected to happen?
How did you install
bat
?Through cargo install
system
$ uname -srm
Darwin 19.3.0 x86_64
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76
bat
$ bat --version
bat 0.15.0
$ env
bat_config
bat_wrapper
No wrapper script.
bat_wrapper_function
No wrapper function for 'bat'.
No wrapper function for 'cat'.
tool
$ less --version
less 487 (POSIX regular expressions)
The text was updated successfully, but these errors were encountered: