Open cipriancraciun opened 4 years ago
Print the available options? How? I think I need a bit more detail to fully evaluate this proposal.
Printing multiple options probably needs multiple lines, and liner isn't likely to gain any additional options that result in multiple line drawing (SetMultiLineMode notwithstanding).
Sorry, I should have been more thorough in my initial request.
Say I want to use liner
to ask the user to choose among a few options, say yes
/ no
, or the name of the days, etc. I would like to be able to make liner
display the user the few available options so he knows immediately what he can enter.
Now, if the number of available options is too large and don't fit a single line, it's OK to just trim them to the first few options that fit.
(Basically it doesn't change the way completion display works, just the fact that the tab completion is triggered immediately, and doesn't wait for the user to press tab
.)
I'm still having difficulty visualizing how the proposed multiple options would appear. How do you plan to implement temporary-overstrike-mode? Do you plan to use some sort of delimiter so the user knows where the suggestion ends if they're typing in the middle of a line of input?
I don't expect any changes to be made to the way the current completion is performed. (I.e. they are performed as now on a separate line.)
The only change I'm proposing to make is this: when the user is shown the prompt, before it reads any user input, liner
behaves just like the user has pressed Tab
and displays the possible completion values; then from here on it is business as usual.
Perhaps the feature request could have been better called: "add an option to display auto-completion options immediately without waiting for the user to press Tab
".
then from here on it is business as usual.
Assuming you mean "behave as if tab was pressed after every keystroke": That would make it impossible to type a non-completed value if the first part of your non-completed value happened to match a tab value.
Assuming you mean "behave as if tab was pressed exactly once, when Prompt is called", that's exactly the same as calling the completion function yourself and then calling PromptWithSuggestion
instead of Prompt
.
Assuming you mean "behave as if tab was pressed exactly once, when Prompt is called", that's exactly the same as calling the completion function yourself and then calling
PromptWithSuggestion
instead ofPrompt
.
It's not exactly the same thing, as for example if in a future you would update your code to allow choosing the option with direction keys, or ordering the completions in any way, it would be consistent. If I would have called the completion and displayed it myself, it would be inconsistent with any such future updates.
Sometimes, for example when
liner
is used to allow the user to choose from a few options, it would be useful to immediately print the available options, instead of waiting the user to press theTab
key first.I think a function like
SetTabCompletionImmediate (bool)
would enable users to control this.If this change would be accepted, I could try to provide the implementation.