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
[Console] Support a set of control keys and key combinations in QuestionHelper #48287
base: 6.3
Are you sure you want to change the base?
Conversation
Hey! Thanks for your PR. You are targeting branch "6.2" but it seems your PR description refers to branch "6.3". Cheers! Carsonbot |
6d3e73c
to
51b434d
Compare
Now I have a stand that needs to be reviewed. I add a zip for easier testing. Feel free to test and try it and find all the bugs. The solution might not be perfect, but for me it seems to work fine. Only with ESC the solution has it's problems. Maybe someone has for that an idea. ESC is "\033" and ctrl buttons as well start with this char. Current Test failures seem not to be related to the PR. |
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.
This is a great improvement for user experience in interactive commands.
I understand that is a proof-of-concept. There is other key and key combination to get the same experience than the shell.
- Key HOME and END (same as Ctrl+A and Ctrl+E)
- Key Alt+Right Arrow and Alt+Left Arrow move from word to word (I just discovered that the behavior is not the same on bash or zsh, the
-
is a word-breaker on bash, not on zsh)
https://stackoverflow.com/questions/5029118/bash-ctrl-to-move-cursor-between-words-strings
@GromNaN thanks for your input. Yes, you're right, it's a proof of concept. Because of that i ask for comments on this approach. Now there is a solid base and i need feedback to optimize it. I'll have a look to the other key combinations you mentioned. |
Added the mentioned:
Test zip: test-48287-2.zip |
One problem for now is with a question in a output section with UPDATE found a solution for the section input. not very nice, maybe someone has a good idea here. I create a new |
015ba6d
to
0d1cbd1
Compare
I think the keys should match default readline configuration. Though we might not need to cover all readline features. |
hi @Chi-teck and thanks for the link. I'll have a look to that the next days in detail. But i guess some of the keys are already implemented the way readline has implemented it as well. But of course we'll only have a set of this keys. |
Hi @Chi-teck, I updated the description of this PR including all of the currently supported key combinations. It matches the keys of readline and has just some bash additions added. I of course only added key combinations making sense to the question helper input. |
Add support for using arrow keys in the QuestionHelper.
There was already a try #36700 to fix the issue.
The approach here does not depend on
readline
at all (removed in #17669)For now it's an RFC. I'm free for other ideas and criticism on this approach.
For now in this PR are supported these key combinations:
←
CTRL
+B
→
CTRL
+F
CTRL
+←
ALT
+B
CTRL
+SHIFT
+←
CTRL
+→
ALT
+F
CTRL
+SHIFT
+→
CTRL
+H
Backspace
Delete
CTRL
+A
Home
CTRL
+E
End
Feel free to test it out and leave comments about the experience.
For better testing i now created a repo https://github.com/maxbeckers/symfony-cli-input-handling