Skip to content
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

Unhandled carriage return as 'Enter' #176

Open
Carnicero90 opened this issue Nov 19, 2024 · 2 comments · May be fixed by #177
Open

Unhandled carriage return as 'Enter' #176

Carnicero90 opened this issue Nov 19, 2024 · 2 comments · May be fixed by #177

Comments

@Carnicero90
Copy link

Laravel Prompts Version

0.3.2

Laravel Version

11.31.0

PHP Version

8.3.3

Operating System & Version

macOS 14.5

Terminal Application

alacritty, builtin vscode terminal, etc

Description

Whenever my terminal doesn't convert carriage return to new line (not sure why taht's happening, it seems to be caused by prompts though, for whatever reason), I am unable to submit any prompt, since \r isn't handled.

I think you could either add icrnl in Terminal@setTty or submit on $key == Key::CARRIAGE_RETURN as well, maybe?

I patched via
` public function setTty(string $mode): void
{
$this->initialTtyMode ??= $this->exec('stty -g');

    $this->exec("stty $mode icrnl");
}`

in my repo, I'm not quite sure of all the implications of this approach though.

Steps To Reproduce

stty -icrnl
php artisan make:request
try to press enter

@jessarcher
Copy link
Member

Hey @Carnicero90,

I started working on a PR to accept \r (in addition to \n), which seems to work with -icrnl set. However when I went to stage the commit (using git add -p) I found that -icrnl also broke the Enter key in git, which gave me pause. Instead of staging the hunk, it just output ^M.

I don't think that's a reason not to accept \r, but I'm curious whether git's patch mode UI is also broken for you when pressing Enter?

@jessarcher jessarcher linked a pull request Nov 20, 2024 that will close this issue
@Carnicero90
Copy link
Author

It does indeed, never noticed since I generally have a dedicate pane for git stuff.
Btw I think the issue may be caused by psysh use of less for pagination, whenever the process doesn't terminate gracefully. I'll try to figure out when that happens, using strace or whatever tracking tool is available in macos.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants