Bläddra i källkod

feat(ui/chat): add ESC focus navigation between panels

ESC in message input resets and focuses messages list; ESC in messages
list clears selection and focuses guilds tree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude 1 månad sedan
förälder
incheckning
150b41094a
4 ändrade filer med 4 tillägg och 1 borttagningar
  1. 1 0
      CLAUDE.md
  2. 1 0
      README.md
  3. 1 0
      internal/ui/chat/message_input.go
  4. 1 1
      internal/ui/chat/messages_list.go

+ 1 - 0
CLAUDE.md

@@ -69,6 +69,7 @@ This is the persistent context file for Claude Code. Keep it concise and useful.
 - **Command mode**: `:` keybind opens vim-style command input, supports `:q`/`:quit`/`:logout` (`command_input.go`)
 - **LRU cache cap**: `itemByID` map evicts stale entries when exceeding 500 items (COMP #17)
 - **Replace open-golang**: replaced `skratchdot/open-golang` with stdlib `os/exec` + `runtime.GOOS` (TECH #1)
+- **ESC focus navigation**: ESC in message input → focus messages list; ESC in messages list → focus guilds tree
 
 ## Config Fields We Added
 - `image_viewer` — external image viewer command (default: `"mpv"`, `"default"` = system opener)

+ 1 - 0
README.md

@@ -10,6 +10,7 @@ A fork of [discordo](https://github.com/ayn2op/discordo) — a lightweight Disco
 - **Tooltip**: `o open` appears in the bottom help bar when a message has attachments or URLs
 - **Guild state persistence**: Remembers which guilds are expanded/collapsed between sessions (saved to `~/.cache/discordo/state.json`)
 - **Focus on channel select**: When AutoFocus is enabled, selecting a channel focuses the messages list instead of the message input
+- **ESC focus navigation**: Pressing Escape in the message input switches focus to the messages list; pressing Escape again switches focus to the guilds tree
 - **Security hardening**: Path traversal prevention on attachment filenames, HTTPS-only downloads with size limits, restrictive file permissions (0700/0600), image viewer validation, atomic state file writes, environment token warning
 
 ## Building on Arch Linux

+ 1 - 0
internal/ui/chat/message_input.go

@@ -146,6 +146,7 @@ func (mi *messageInput) HandleEvent(event tview.Event) tview.Command {
 				})
 			} else {
 				mi.reset()
+				cmds = append(cmds, tview.SetFocus(mi.chat.messagesList))
 			}
 			return tview.Batch(cmds...)
 		case keybind.Matches(event, mi.cfg.Keybinds.MessageInput.TabComplete.Keybind):

+ 1 - 1
internal/ui/chat/messages_list.go

@@ -660,7 +660,7 @@ func (ml *messagesList) HandleEvent(event tview.Event) tview.Command {
 		switch {
 		case keybind.Matches(event, ml.cfg.Keybinds.MessagesList.Cancel.Keybind):
 			ml.clearSelection()
-			return nil
+			return tview.SetFocus(ml.chatView.guildsTree)
 		case keybind.Matches(event, ml.cfg.Keybinds.MessagesList.SelectUp.Keybind):
 			return ml.selectUp()
 		case keybind.Matches(event, ml.cfg.Keybinds.MessagesList.SelectDown.Keybind):