summaryrefslogtreecommitdiff
path: root/internal/ui/table.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-22 16:31:28 +0300
committerPaul Buetow <paul@buetow.org>2026-04-22 16:31:28 +0300
commit18a51e3dd522cc40508358e6ff843348d38530d3 (patch)
treeea12e0a153435fccc9f8f7afd518aa68258871c9 /internal/ui/table.go
parent4a42f57033bb58c3603422431832ba6fdddec703 (diff)
Fix h7 agent hotkey normalization
Diffstat (limited to 'internal/ui/table.go')
-rw-r--r--internal/ui/table.go36
1 files changed, 35 insertions, 1 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index 398aeeb..b1008fd 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -1366,7 +1366,7 @@ func (m *Model) SetUltra(u bool) {
// ultra mode. If it does, the current hotkey is left unchanged and an error is
// returned so callers can surface the conflict.
func (m *Model) SetAgentFilterHotkey(key string) error {
- key = strings.TrimSpace(key)
+ key = normalizeAgentFilterHotkey(key)
if key == "" {
return nil
}
@@ -1395,6 +1395,40 @@ func validateAgentFilterHotkey(key string) error {
return nil
}
+func normalizeAgentFilterHotkey(key string) string {
+ key = strings.TrimSpace(key)
+ if key == "" || len(key) == 1 {
+ return key
+ }
+ switch strings.ToLower(key) {
+ case "down":
+ return "down"
+ case "end":
+ return "end"
+ case "enter":
+ return "enter"
+ case "esc", "escape":
+ return "esc"
+ case "home":
+ return "home"
+ case "left":
+ return "left"
+ case "pgdn", "pgdown":
+ return "pgdn"
+ case "pgup":
+ return "pgup"
+ case "right":
+ return "right"
+ case "space":
+ return "space"
+ case "tab":
+ return "tab"
+ case "up":
+ return "up"
+ }
+ return key
+}
+
var reservedAgentHotkeys = map[string]struct{}{
"+": {},
"0": {},