-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
feature: Deno.ttySize() #3790
feature: Deno.ttySize() #3790
Conversation
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.
Nice work! I'm glad to see you were able to figure out how to add ops.
I'm not keen to take on new dependencies but crossterm looks good and will certainly be useful in the future. I'm going to now try to remove our termcolor = "1.0.5"
and ansi_term = "0.11.0"
and atty = "0.2.13"
.
Generally we prefer unit tests to integration tests because they run faster. I've edited your PR to do that. I've also marked it as unstable, since it's new.
I wonder if |
Actually I'm having second thoughts about crossterm because we have a lot of TTY crates and I would either like to reduce them to a single dependency or not add more. It doesn't seem like crossterm would allow reducing deps. Here is a list of our current TTY crates:
So I wonder if there is a smaller crate which can provide the functionality? Or can we just rip out the implementation from crossterm? We can certainly issue the |
@ry Hi, thanks, yes, sorry, missed the unit test code in there, thanks for moving that. Happy to keep an eye on this and help out on any enhancements down the road. I am guessing this is all fairly preliminary at this point, so happy to follow along with all design considerations on the tty api as things progress. Many thanks |
Wow I totally forgot that we've already got term width/height in our code: Line 398 in c824eb5
I'm not sure what to do yet, but I'm more convinced that we need to clean up the TTY crate situation rather than adding a new dep. |
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.
Needs more investigation
Thanks for the patch @sinclairzx81 but I'm going to close without merge. I don't want to add this crossterm dep. This ttySize op is definitely desirable, but I think we can achieve it (at least on unix) with a single line as I gave above. |
@ry it seems like you'll need something like CrossTerm (or similar code) for node |
Any update on this? My current deno readline-esque implementation for my shell is broken when you hit the edge of the terminal, not sure if I can go any further without checking the size of the terminal as well as resize events |
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
…ns and rows property on STDOUT To be able to build rich CLI tools, it is very useful to be able to calculate the terminal's number of columns and rows. Although we could use tput through `Deno.run`, this approach is a bit slow and convoluted. Resolves: denoland#3456 References: denoland#3790
This PR implements the
Deno.ttySize()
API for obtaining the current terminal dimensionscolumns/rows
. This update takes a dependency on the crossterm crate which should facilitate cross platform queries for current terminal dimensions.PR is submitted for review and feedback with reference to issue #3456