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
{{ message }}
Repository navigation
Auto-resize Predictor ListView when the height is too small #3563
When my shell windows are too small to display all ten predictions in ListView, it should reduce the size to be able to display a smaller number of predictions.
This is particularly applicable in CloudShell where the default window when you open CloudShell is too small for ListView and so fails silently when I try using F2 and gives this error message when I try to set:
PS /home/steven> Set-PSReadLineOption -PredictionViewStyle ListView
WARNING: The prediction 'ListView' is temporarily disabled because the current window size of the console is too small. To use the 'ListView', please make sure the 'WindowWidth' is not less than '54' and the 'WindowHeight' is not less than '15'.
Incorporate similiar error message that Set-PSReadLineOption gives when the user tries F2
Make ListView number of results resizable based on the window.
Make ListView number of results resizable based on the window and incorporate scrollable functionality to enable users to see the other results given a smaller window.
In the future, It would be great if ListView could resize, within reason, to the smaller window - perhaps only displaying 3 lines. Most important I think is an error message to display if the windows size is too small. In the graphic below, I pressed F2 after typing:
Get-
Nothing is displayed. But when I max the window - F2 works as expected.
I improved the scrollable list view to be able to adjust the list height accordingly based on the terminal height, and print warning when the terminal size is too small to show the list view.
Dongbo Wang (@daxian-dbw) Instead of showing a warning when it gets too small, maybe it could automatically switch to the PredictionInlineView when the windows is smaller than PredictionListView.MinWindowHeight and switch back when the terminal window height becomes greater than PredictionListView.MinWindowHeight?
PSReadLine uses inline view by default, so for Cloud Shell and VSCode users, they usually will press F2 attempting to change to list view. When the terminal size is too small to show the list view, we will still need to write out the warning message, because otherwise the user will find no change/feedback and thus not sure whether F2 stopped working.
Also, there are cases where the terminal height becomes too small while navigating within the list, when a particular list item has a long text that takes up a big chunk of space. In those cases, list view is still working in general, just not working for that particular list item.
With the new improvements, the list view would theoretically work as long as the terminal height is >= 5, which should cover most of the scenarios like the Cloud Shell and VSCode, if not all. At the meantime, changing between inline and list views is very simple -- pressing F2, so I prefer the user making the view change explicitly instead of depending on PSReadLine being that smart, so as to reduce code complexity.
Activity
theJasonHelmick commentedon Feb 2, 2023
In the future, It would be great if ListView could resize, within reason, to the smaller window - perhaps only displaying 3 lines. Most important I think is an error message to display if the windows size is too small. In the graphic below, I pressed F2 after typing:
Nothing is displayed. But when I max the window - F2 works as expected.
StevenBucher98 commentedon Feb 4, 2023
Related to: #3557
daxian-dbw commentedon Feb 6, 2023
I improved the scrollable list view to be able to adjust the list height accordingly based on the terminal height, and print warning when the terminal size is too small to show the list view.
ChristopherHaws commentedon Feb 6, 2023
Dongbo Wang (@daxian-dbw) Instead of showing a warning when it gets too small, maybe it could automatically switch to the
PredictionInlineViewwhen the windows is smaller thanPredictionListView.MinWindowHeightand switch back when the terminal window height becomes greater thanPredictionListView.MinWindowHeight?daxian-dbw commentedon Feb 6, 2023
PSReadLine uses inline view by default, so for Cloud Shell and VSCode users, they usually will press
F2attempting to change to list view. When the terminal size is too small to show the list view, we will still need to write out the warning message, because otherwise the user will find no change/feedback and thus not sure whetherF2stopped working.Also, there are cases where the terminal height becomes too small while navigating within the list, when a particular list item has a long text that takes up a big chunk of space. In those cases, list view is still working in general, just not working for that particular list item.
With the new improvements, the list view would theoretically work as long as the terminal height is
>= 5, which should cover most of the scenarios like the Cloud Shell and VSCode, if not all. At the meantime, changing between inline and list views is very simple -- pressingF2, so I prefer the user making the view change explicitly instead of depending on PSReadLine being that smart, so as to reduce code complexity.