-
Notifications
You must be signed in to change notification settings - Fork 322
Provide 80x24 fallback for ansi and vt100 #465
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
Conversation
2 similar comments
urwid/raw_display.py
Outdated
# Provide some lightweight fallbacks in case the TIOCWINSZ doesn't | ||
# give sane answers | ||
if x <= 0 or y <= 0: | ||
if self.term == 'ansi' or self.term == 'vt100': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.term == 'ansi' or self.term == 'vt100': | |
if self.termin('ansi', 'vt100'): |
And will be good to join 2 if's
Please rebase: Travis not providing logs (technically not functional) and without logs hard to see what was wrong with current PR |
Rebased and made the change you suggested (I think). This was apparently open for like 2 years and I've completely forgotten it existed, so forgive me if I'm a little slow on the uptake here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 2 it's can be squashed and LGTM
urwid/raw_display.py
Outdated
if x <= 0 or y <= 0: | ||
if self.term in ('ansi','vt100'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if x <= 0 or y <= 0: | |
if self.term in ('ansi','vt100'): | |
if (x <= 0 or y <= 0) and self.term in ('ansi','vt100'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Not all terminals will necessarily respond to the TIOCGWINSZ ioctl, particularly much older ones providing vt100 or ansi terminals, which will have a fixed 80x24 size. If they respond with some kind of non-sensical value here, then at least give the ansi and vt100 terminals their default so they can draw.
Not all terminals will necessarily respond to the TIOCGWINSZ ioctl,
particularly much older ones providing vt100 or ansi terminals, which
will have a fixed 80x24 size. If they respond with some kind of
non-sensical value here, then at least give the ansi and vt100 terminals
their default so they can draw.
Checklist
master
orpython-dual-support
branchtox
successfully in local environment (my pypy isn't set up, but it's otherwise good)Description:
I've been working with some older machines that present a classic
ansi
orvt100
terminal, and whilencurses
worked just fine with them, theraw_display
fromurwid
did not. I tracked this down to the use ofTIOCGWINSZ
. This ioctl wasn't providing meaningful dimensions for these old terminals. It looked likeurwid
was getting 0x0, whilescreen
was getting -1x-1. These terminal types have a fixed width and height as per theirtermcap
descriptions, and they're ubiquitous, so I provided some fallback values shouldTIOCGWINSZ
not give workable dimensions.I tried to see if a patch like this was rejected in the past, but forgive me if I missed it.