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

fitwidth doesn't always get correct window width #117

Open
pfuntner opened this issue Sep 20, 2024 · 0 comments
Open

fitwidth doesn't always get correct window width #117

pfuntner opened this issue Sep 20, 2024 · 0 comments

Comments

@pfuntner
Copy link
Owner

pfuntner commented Sep 20, 2024

I think I've noticed this in the past but I am just getting around to opening a story about it:

$ python -c 'print("*"*500)'
********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
$ python -c 'print("*"*500)' | fitwidth
************************************************************************************************************************************************************************************************************************************************************************** ...
$ python -c 'print("*"*500)' | fitwidth | head
*************************************************************************** ...
$ cols
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222
0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
$

I think I changed things recently to use a different method of determining the width but when stdout of fitwidth isn't a terminal, the result can be wrong - it looks like it's falling back on a default of 80 characters. I might need to get the infomation specifically from /dev/tty instead of stdout... I don't even know if that's possible but this is a problem.

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

1 participant