-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support for getting terminal width & height #50
Comments
I've had a look at implementing this - the main problem as I see it is that currently the unix implementation does everything with terminfo, therefore not needing to make any system calls directly. The best way to get the console dimensions is to issue an ioctl to populate the According to https://unix.stackexchange.com/questions/93173/how-does-less-know-the-terminal-resolution the program So questions:
|
You can see my messings about at https://github.com/derekdreery/term :master |
As for getting this working on unix, given that #49 will be a breaking change anyways I plan on reworking the internals quite a bit (after it lands) so this will probably get much easier. |
http://docs.freebsd.org/44doc/usd/13.viref/paper.html#section5f seems like a good strategy? |
@derekdreery Yes, that looks good. However, I'm probably going to reorder those a bit (use ioctl first, then the environment, then the terminfo database. |
Would this be possible in Windows too? |
Yes but I won't be able to do that myself (I don't use windows). |
I put the windows function on the top of this thread - I can implement it - waiting on some constants in libc at the moment |
... a long time later I've submitted PR #77 to implement this. |
Getting the terminal width and height is something you cannot do presently with the
Terminal
trait. It prevents implementation of something like termbox on top ofTerminal
trait.The linux implementation looks something like (from termbox)
whilst in windows the relevant function is
kernel32::GetConsoleScreenBufferInfo
The text was updated successfully, but these errors were encountered: