fix: unify keyboard handling and add q key support#63
Conversation
- Fix race condition where warningsReady was never set if WindowSizeMsg arrived before AWS init failed - Add 'q' key to quit the app (was documented in help but not implemented) Fixes #60
- Remove dead code: q key handler in DiffView (now handled by app) - Remove q from ProfileDetailView modal close (consistency with help) - Add :q/:quit command for vim-style quit - Update README with q key and :q command docs
Modals should intercept q to close rather than letting it quit the app. This prevents accidental app quit while viewing profile details.
- Add q key to close modals in handleModalUpdate (centralized) - Remove redundant esc/q handling from ProfileDetailView (keep d only) - Now all modals close consistently with q key
Code ReviewThank you for this PR! This is a nice UX improvement that addresses issue #60 and unifies keyboard handling across the application. Overall, the implementation is solid, but I've identified a few issues and suggestions. Critical Issues1. Logic Bug in
|
- Remove unreachable q key checks in DetailView/DiffView (app.go intercepts first) - Add TestWarningScreenDismissal for Enter/Space/q dismissal - Add TestCommandInput_QuitCommand for :q/:quit commands - Simplify warningsReady with clarifying comment
|
Addressed review feedback in 82bf15d: Re: items 1, 2 - Not bugs. The quit key logic correctly falls through to Changes made:
All tests pass, lint clean. |
Code ReviewThanks for working on this fix for issue #60! The PR addresses important keyboard handling improvements. I've reviewed the changes and have some feedback: Critical IssueBug in warning screen dismissal (app.go:117): if keyMsg.Code == tea.KeyEnter || keyMsg.String() == "space" || keyMsg.String() == "q" {The space key check is incorrect. In Bubbletea v2, when you press the space key, Fix: Change to: if keyMsg.Code == tea.KeyEnter || keyMsg.Code == tea.KeySpace || keyMsg.String() == "q" {This is confirmed by your own test at app_test.go:311, which correctly uses Code QualityPositive aspects:
Suggestions:
Performance ConsiderationsNo performance concerns. The changes are straightforward key event handling. Security ConcernsNone identified. This is UI navigation code with no security implications. Test CoverageGood test coverage overall, but:
SummaryThe PR is well-structured and addresses the issue, but has a critical bug that will prevent the space key from working. The fix is simple (use Recommended actions:
|
Summary
qkey as quit shortcut globally:q/:quitcommandqacts as back in DetailView/DiffView (natural navigation)Closes #60
Changes
app.go: Addqto Quit keybinding, handleqas back for detail viewscommand_input.go: Add:q/:quitcommanddetail_view.go/diff_view.go:qreturns to previous viewprofile_detail_view.go:qcloses modalREADME.md: Update key bindings doc