Skip to content

Comments

support submit-on-valid-parse#321

Open
JeanMertz wants to merge 1 commit intomikaelmello:mainfrom
JeanMertz:submit-on-valid-parse
Open

support submit-on-valid-parse#321
JeanMertz wants to merge 1 commit intomikaelmello:mainfrom
JeanMertz:submit-on-valid-parse

Conversation

@JeanMertz
Copy link

This allows CustomType prompts to auto-submit when the input is valid. Specifically, this makes it possible to have prompts similar to Git's:

$ git add -p
... <snip> ...

(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? ?
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
g - select a hunk to go to
/ - search for a hunk matching the given regex
e - manually edit the current hunk
p - print the current hunk, 'P' to use the pager
? - print help
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? q

Which don't require the return key to be pressed when a valid option is provided.

@JeanMertz
Copy link
Author

I just noticed #317 which does something similar, but for the Confirm prompt.

I took some of their code, and ported it to this more generic implementation, so now the Confirm prompt also has a confirm_on_input option.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz force-pushed the submit-on-valid-parse branch from b85e8a8 to a8eaf93 Compare January 14, 2026 12:18
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 this pull request may close these issues.

1 participant