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

Add alternative path to retrieve terminal size if available #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arcivanov
Copy link

Use os.get_terminal_size if it is available
Maintain original path if not

related to #48

Use `os.get_terminal_size` if it is available
Maintain original path if not

related to pfalcon#48
@pfalcon
Copy link
Owner

pfalcon commented Jan 30, 2021

Thanks, but the whole purpose of picotui's existence is to oppose such programming style. Picotui is a thin layer above terminal escape sequences, not a patch-mess of #ifdef's like that.

If some terminal escape sequence doesn't work with a particular terminal emulator, I'd be interested to investigate why, and if possible, fix that.

@arcivanov
Copy link
Author

@pfalcon The os.get_terminal_size uses either IOCTL or conio, depending on how it's compiled, i.e. you'd need to look at conio source for all the possible options. If it's IOCTL then it's not replicable without actually doing ioctl.

https://github.com/python/cpython/blob/master/Modules/posixmodule.c#L13056

@pfalcon
Copy link
Owner

pfalcon commented Jan 31, 2021

picotui is intended to work with following terminals: a) VT100, which is a "dumb" terminal with hardcoded size 80x24; b) Xterm, which is a smarter terminal, and offers capability to query the screen size. picotui is intended to run on remote systems which don't have ioctl, conio, or any mess like that. The only requirement for picoui is stdin and stdout, and smart (ideally) terminal on the other end of those.

@pfalcon
Copy link
Owner

pfalcon commented Jan 31, 2021

And to explicate the topic of the discussion: I'm explaining why I don't jump to merging this patch right away. I consider it a workaround, and the real issue being that Konsole doesn't seem to respond to Xterm "query screen size" escape sequence, like Gnome Terminal does. I'd like to investigate that issue first, which may render this patch unneeded.

Or vice-versa, it may turn out to be still useful. But so far, more investigation for the Konsole issue is needed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants