Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Console] Support a set of control keys and key combinations inQuestionHelper
#48287
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:7.4
Are you sure you want to change the base?
Conversation
carsonbot commentedNov 22, 2022
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
to51b434d
Comparemaxbeckers commentedNov 24, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
GromNaN left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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
Uh oh!
There was an error while loading.Please reload this page.
@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 |
maxbeckers commentedNov 26, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 |
0d1cbd1
tof06911a
CompareI 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. |
maxbeckers commentedJan 23, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
Chi-teck commentedNov 29, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The question helper used in Symfony console looks so outdated. Especially when compared with Laravel prompts and some JS implementations. I wonder if it possible to make it swappable. So a third party packages could provide a replacement for it. |
@maxbeckers could you add support for CTRL-C as well here or is that another problem? Seecomposer/composer#12106 for example. |
Hi@Seldaek, good idea. I'm currently on vacation. Afterwards I'll have a look on that. |
Hi@Seldaek, I tried to reproduce that. When I use composer, then I can reproduce your problem: So it seems to be a bug in relation to run the composer script. => No need to change anything for |
QuestionHelper
@maxbeckers ah you're right sorry about that. Figured out some more details herecomposer/composer#12106 (comment) |
Uh oh!
There was an error while loading.Please reload this page.
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)This key combinations are added:
←
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.
UPDATE For better testing i now created a repohttps://github.com/maxbeckers/symfony-cli-input-handling