Skip to content
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

Window size detection for Git Bash pager falls back to default values #26

Open
Velociraptor45 opened this issue Dec 30, 2023 · 1 comment

Comments

@Velociraptor45
Copy link

Hey there, this is kind of a follow-up to #22. It works fine for the normal git bash window, however when opening e.g. a less pager in that window, it falls back to the default 80/24 values.
I've debugged it and I think I found a bug, but I'd like your confirmation on this.

STR

  1. Comment out the following in the index.js to simulate the pager without having to actually have a pager (line 60 is where we'd like to go):
    grafik
  2. Temporarily add the following to the bottom of the index.js to execute the size function upon calling the script
var x = terminalSize();
console.log(x);
  1. Execute the index.js in a Git Bash and see that it's not returning the correct window size.
    grafik

Possible Solution

The index.js contains this line:
grafik

The 'ignore' is duplicated and when I replace the second one with process.stderr, it's working fine.

grafik

Resulting in correct window sizes:

grafik

Any opinion on this?

@sindresorhus
Copy link
Owner

It's set to ignored because we don't really want to output any potential error message to the user's stderr, but if there's no other way, I guess we can do it. But only on Windows. So you could make the exec function accept a stdio option (which would default to the current value) and use that in the tput function when on Windows.

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

No branches or pull requests

2 participants