You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to get the screen height accounting for the prompt so that I can assure my screens are completely visible on render. For example given a terminal height of 10 and a prompt height of 2 I would expect the method to return a height of 8.
How would the new feature work?
Ideally the feature would find and calculate the height of the prompt in use and subtract it from the screen height.
visible_height=TTY::Screen.visible_height
Alternatively you could provide a method that just produces the prompt height and let the end user do the math:
It might take some magic, I've been having a hard time detecting my own prompt height (p10k) but I'm also not a terminal wizard like you are and my hope is you'd know some tricks that I definitely do not.
The text was updated successfully, but these errors were encountered:
Thank you for your interest in the TTY Toolkit and particularly this gem.
From the start, my aim for each tty-* gem is to keep it focused on a single task. Hence this gem measures the terminal screen and doesn't aim to do anything outside of that.
As for the API addition of the visible_height. The name is confusing. Why? Whether the terminal prompt is there or not, or how tall it is is irrelevant to the visibility of the screen. You can move the cursor anywhere in the terminal screen size, which means you can print over the prompt.
More importantly, as you found out determining prompt height is rather a difficult task. Reading terminal info won't be of much help here. Equally trying to read from the environment variable such as PS1, which may or may not be set, you would still need to expand the string to find out how many rows it takes up.
Unfortunately, I won't be adding any such functionality to this gem and I'm afraid I don't have any good suggestions either. However, if you find some robust solution to your problem please let me know as I'd be curious how you resolved this.
Describe the problem
I would like to get the screen height accounting for the prompt so that I can assure my screens are completely visible on render. For example given a terminal height of 10 and a prompt height of 2 I would expect the method to return a height of 8.
How would the new feature work?
Ideally the feature would find and calculate the height of the prompt in use and subtract it from the screen height.
Alternatively you could provide a method that just produces the prompt height and let the end user do the math:
Drawbacks
It might take some magic, I've been having a hard time detecting my own prompt height (p10k) but I'm also not a terminal wizard like you are and my hope is you'd know some tricks that I definitely do not.
The text was updated successfully, but these errors were encountered: