fix(prompt): support ESC to skip PR creation#85
Conversation
huh v1.0.0's default `KeyMap.Quit` binding only includes `ctrl+c`; pressing ESC at the form level was silently ignored. Fix `InputWithSkip` to build the form manually with a custom keymap that adds `esc` alongside `ctrl+c` as quit keys, so both gestures trigger `huh.ErrUserAborted` and skip PR creation cleanly. Also corrects the fallout message from "(user pressed ESC)" to "(skipped)", which is accurate regardless of which key was used. `charmbracelet/bubbles` (already an indirect dep) is promoted to direct because we now import its `key` sub-package explicitly. Closes #78
|
Claude finished @boneskull's task in 1m 8s —— View job Code Review
The fix is correct and well-targeted. The root cause analysis in the PR description is accurate:
The approach is idiomatic for km := huh.NewDefaultKeyMap()
km.Quit = key.NewBinding(
key.WithKeys("ctrl+c", "esc"),
key.WithHelp("esc/ctrl+c", "skip"),
)Starting from
The skip message fix (
Promoting Summary: The fix is correct and the implementation is clean. Only two minor doc comment nits remain — both say "pressing ESC" where "ESC or Ctrl+C" would now be accurate. |
Summary
gh stack submit(user pressed ESC)to(skipped)— accurate regardless of which key was usedRoot cause
huhv1.0.0's defaultKeyMap.Quitonly bindsctrl+c. ESC is not wired to quit at the form level, so it was silently ignored.InputWithSkipwas callinghuh.NewInput().Run(), which internally wraps the field in a new form with the default keymap. The fix builds the form manually with a custom keymap that addsescalongsidectrl+cas quit keys.Notes
charmbracelet/bubbles(already an indirect dep viahuh) is promoted to a direct dependency since we now import itskeysub-package explicitly.Closes #78