-
Notifications
You must be signed in to change notification settings - Fork 93
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
The Select Component is not responding to the arrow keys #31
Comments
Hey @Quaap70. Thanks for reporting this. I haven't seen an issue with the arrow keys on macOS but I'll see if I can replicate this. If not, I might need your help figuring out the character codes that are being sent on your system. |
Hey @jessarcher Thanks for the quick response, and for taking the time to research this... I tested it on my desktop and on my old MacBook, and on those devices it works fine. All computers configured almost identically On my 2020 Mac Mini (M1) it works perfectly On all three devices iTerm is configured the same way, with oh-my-zsh and powerlevel10K. I've tried to figure out which character codes the arrow keys generate, but no idea where to look. It works fine with just the H and J keys of course, so if I'm really the only one reporting this problem... Even with only H and J it works ten times better than before Prompts. |
Thanks @Quaap70! Could you try running the following minimal debugging script on the affected command line (e.g. <?php
$initialMode = shell_exec('stty -g');
register_shutdown_function(function () use ($initialMode) {
echo 'Restoring TTY'.PHP_EOL;
shell_exec('stty '.$initialMode);
});
shell_exec('stty -icanon -echo -isig');
while ($keys = fread(STDIN, 1024)) {
echo json_encode($keys).PHP_EOL;
if ($keys === "\x03") {
exit(0);
}
} If you press the arrow keys, it should echo the keys being received. They're JSON-encoded as an easy way to escape the escape sequences, which would otherwise output non-printable characters and do weird things to your terminal. You can then press The This is what the output looks like on my machine after pressing |
Hey @jessarcher Thanks for the response. I ran your script and below is the result. The sequence is in the same order as in your example above: "\u001bOA" Hopefully this is helpful to you.. |
Thanks for that! I haven't seen escape sequences with an I can probably make Prompts respond to the sequences you pasted, but I'd like to understand it a bit more and ideally replicate it first. I'll pull out my old Macbook and mess around with iTerm settings to see what I can come up with. |
I'm not sure if this is of any use to you, but I found the below script here on github. It seems my iTerm2 escape sequences are not totally unknown. Maybe the context of the script tells you something that will help you... I'm lost 😶 https://github.com/krajj7/BotHack/blob/master/jta26/de/mud/terminal/vt320.java line 1926 |
Thanks! This Stack Exchange post does a pretty good job of explaining the difference. Not sure why one of your iTerms would be sending the other ones but I don't see any issues supporting it. I've created a PR at #40. It would be great if you could test it out for me as I haven't found a way of replicating it locally (even with the There are some test scripts in the |
Unfortunately I'm not that familiar with pull requests, and merging and testing them... Sorry 😔 The way is probably very cumbersome, and perhaps not the fastest, but I think it worked out in the end with the following steps: I performed a new laravel installation. Then I overwrote the Prompts folder with the files from the The result is positive, Prompts now responds to my arrow keys! |
EDIT: Removed. I'm going to create a separate issue, as I'm only just realising that this one is for navigating between options, but my issue is in regards to being unable to select an option. The new issue: #41 |
Thanks @jessarcher ! |
Laravel Prompts Version
I couldn't find out the prompts version.
Laravel Version
10.17.1
PHP Version
8.2
Operating System & Version
macOS 13.5 (M1)
Terminal Application
iTerm
Description
After installing a fresh laravel and creating a new model, I was asked
Would you like any of the following?
. As far as I understand, I should be able to select the desired options with the arrow keys. Unfortunately the arrow keys do not work, it only works with H and J.I am using iTerm 3.4.19 (tried also the native terminal)
Apple MacBook Pro M1 Pro
Steps To Reproduce
The text was updated successfully, but these errors were encountered: