Conversation
Global keybindings (quit, help, region, etc.) intercepted keypresses before views could handle them in filter mode, causing 'q' to quit instead of typing into filter. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Code Review: v0.14.2 - Fix Global Keybindings in Filter ModeSummaryThis PR successfully fixes issue #158 where global keybindings ( Code Quality ✅Strengths:
Correctness ✅Issue Fixed:
Flow Analysis:
Testing ✅Existing Test Coverage:
Recommendation: func TestGlobalKeysInFilterMode(t *testing.T) {
app := newTestApp(t)
mockView := &MockView{name: "ResourceBrowser", hasInput: true}
app.currentView = mockView
// Test 'q' key (quit) doesn't quit when filter is active
qMsg := tea.KeyPressMsg{Code: 0, Text: "q"}
_, cmd := app.Update(qMsg)
// Should delegate to view, not quit
if cmd != nil && cmd() != nil {
if _, isQuit := cmd().(tea.QuitMsg); isQuit {
t.Error("Expected 'q' to be handled by view in filter mode, not quit app")
}
}
// Similar tests for ?, R, P, A, Ctrl+E...
}Performance ✅Impact: Negligible
Security ✅No Security Concerns:
Architecture & Best Practices ✅Strengths:
Code Location:
Minor ObservationsComment Opportunity (optional): // Route all keypresses to view when it has active input (filter, search, etc.)
if ic, ok := a.currentView.(view.InputCapture); ok && ic.HasActiveInput() {Consistency Note: Verdict: ✅ ApprovedThis is a high-quality bug fix that:
Recommendation: Merge after adding a test case (suggested above) to prevent regression. Great work! This fix demonstrates good understanding of the codebase architecture and follows excellent software engineering practices. |
Summary
Details
Global keybindings (
qquit,?help,Rregion,Pprofile,AAI,Ctrl+Ecompact) intercepted keypresses before views could handle them in filter mode. AddedInputCapture.HasActiveInput()guard before the global key switch block, matching the existing pattern used for Esc/Backspace handling.Closes #158