-
Notifications
You must be signed in to change notification settings - Fork 749
Completion menu rows - Clean up multi-column completion display, especially predictable height #1271
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
base: main
Are you sure you want to change the base?
Conversation
height and width; PromptSession reserve_space_for_menu -> completion_menu_rows; FloatContainer height includes child floats.
whole float displayed at bottom of layout.
284334c to
3ab8898
Compare
|
Rebased on latest master. Added missing backward compatibility: |
164103d to
20760cb
Compare
|
This works really well for me, an issue with the completion dialogue is gone (xonsh/xonsh#3843) and the behavior of space reservation is improved. |
|
Can confirm that this PR solves xonsh/xonsh#3810 and makes |
|
Any chance this MR might be merged for the next release ? |
|
Hi @jonathanslenders! What do you think about this PR? Looks like many thumbups here. |
|
I'm pretty sure this PR is stale, and I don't have time to push it any more. I'm gonna close it next week unless someone wants to take it over. |
|
I think the best thing is to convert it to draft instead of closing because it will keep the chance to be discovered. |
Replace
PromptSessionparameterreserve_space_for_menu, which wasn't really working, with a new parametercompletion_menu_rowsthat has slightly different semantics. Additional layout fixes affecting bothCompletionMenuandMultiColumnCompletionMenunoted below.Parameter
completion_menu_rowslimits the number of rows that a completion menu will display, default 5. It applies equally toCompletionMenuandMultiColumnCompletionMenu. The point of putting a limit on number of rows is that it will render faster and users wouldn't read through a really long completion list anyway, they'll type a few more characters to narrow it down. Other changes ensure that the number of rows will not be reduced when at/near the bottom of the screen. The parameter can be specified onPromptSession.prompt{()orPromptSession.prompt_async()as well. Old parameterreserve_space_for_menuproduces aDeprecationWarningif specified, though the value is used for the new behavior.Other changes in the PR:
completion.Completion.display_meta_textreturnsNone, not empty string if Completion has no meta data. This prevents completion menus from displaying an extra blank line if no completion had meta data.containers.Float-- new optiondont_shrink_height: bool = False. IfTrue, height of Float will not be reduced if it wouldn't fit inFloatContainer. Instead, its preferred height will be considered in the preferred height of theFloatContainer. Default isFalse, the prior behavior. PromptSession layout uses this to ensure completion menus are not shrunk at bottom of screen.layout.MultiColumnCompletionMenu-- new optionmax_rows: int = 5specifies an upper limit on number of rows in the completion menu. Similar to effect ofmax_heightinlayout.CompletionMenu. Also changed the column width calculation to handle outliers in length of completions more gracefully.