Преглед на файлове

feat(keybinds): add 'b' as back keybind (same as ESC)

New configurable `back` keybind (default: `b`) that acts like ESC in
messages list and guilds tree for navigating back between panels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude преди 1 месец
родител
ревизия
d1033da7fa
променени са 4 файла, в които са добавени 11 реда и са изтрити 3 реда
  1. 2 0
      internal/config/config.toml
  2. 4 0
      internal/config/keybinds.go
  3. 3 2
      internal/ui/chat/guilds_tree.go
  4. 2 1
      internal/ui/chat/messages_list.go

+ 2 - 0
internal/config/config.toml

@@ -109,6 +109,8 @@ focus_message_input = "i"
 # Cycle focus between the widgets.
 focus_previous = "h"
 focus_next = "l"
+# Back/cancel (same as ESC).
+back = "b"
 # Hide/show the guilds tree.
 toggle_guilds_tree = "H"
 # Open file picker to attach files.

+ 4 - 0
internal/config/keybinds.go

@@ -143,6 +143,8 @@ type Keybinds struct {
 	FocusPrevious Keybind `toml:"focus_previous"`
 	FocusNext     Keybind `toml:"focus_next"`
 
+	Back Keybind `toml:"back"`
+
 	Picker       PickerKeybinds       `toml:"picker"`
 	GuildsTree   GuildsTreeKeybinds   `toml:"guilds_tree"`
 	MessagesList MessagesListKeybinds `toml:"messages_list"`
@@ -271,6 +273,8 @@ func defaultKeybinds() Keybinds {
 		FocusPrevious: newKeybind("h", "focus prev"),
 		FocusNext:     newKeybind("l", "focus next"),
 
+		Back: newKeybind("b", "back"),
+
 		CommandMode: newKeybind(":", "command"),
 		Logout:      newKeybind("ctrl+d", "logout"),
 		Quit:   newKeybind("ctrl+c", "quit"),

+ 3 - 2
internal/ui/chat/guilds_tree.go

@@ -441,8 +441,9 @@ func (gt *guildsTree) HandleEvent(event tview.Event) tview.Command {
 			return handler(tcell.NewEventKey(tcell.KeyEnter, "", tcell.ModNone))
 		case keybind.Matches(event, gt.cfg.Keybinds.GuildsTree.YankID.Keybind):
 			return gt.yankID()
-		case event.Key() == tcell.KeyEsc:
-			// ESC cycles: input → messages → guilds → input
+		case event.Key() == tcell.KeyEsc,
+			keybind.Matches(event, gt.cfg.Keybinds.Back.Keybind):
+			// ESC/back cycles: input → messages → guilds → input
 			if cmd := gt.chat.focusMessageInput(); cmd != nil {
 				return cmd
 			}

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

@@ -730,7 +730,8 @@ func (ml *messagesList) HandleEvent(event tview.Event) tview.Command {
 	switch event := event.(type) {
 	case *tview.KeyEvent:
 		switch {
-		case keybind.Matches(event, ml.cfg.Keybinds.MessagesList.Cancel.Keybind):
+		case keybind.Matches(event, ml.cfg.Keybinds.MessagesList.Cancel.Keybind),
+			keybind.Matches(event, ml.cfg.Keybinds.Back.Keybind):
 			ml.clearSelection()
 			if cmd := ml.chatView.focusGuildsTree(); cmd != nil {
 				return cmd