From 574be9febf74e9571c0400bfc6de33f5deede977 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:39:59 -0500 Subject: [PATCH] fix: keybind panic (#2092) --- packages/tui/internal/app/app.go | 3 +++ .../tui/internal/components/chat/message.go | 20 +++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index af8157ad..0c703c95 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -207,6 +207,9 @@ func New( func (a *App) Keybind(commandName commands.CommandName) string { command := a.Commands[commandName] + if len(command.Keybindings) == 0 { + return "" + } kb := command.Keybindings[0] key := kb.Key if kb.RequiresLeader { diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index 9a1531fb..a19d15fd 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -671,10 +671,22 @@ func renderToolDetails( body = strings.Join(steps, "\n") body += "\n\n" - body += baseStyle(app.Keybind(commands.SessionChildCycleCommand)) + - mutedStyle(", ") + - baseStyle(app.Keybind(commands.SessionChildCycleReverseCommand)) + - mutedStyle(" navigate child sessions") + + // Build navigation hint with proper spacing + cycleKeybind := app.Keybind(commands.SessionChildCycleCommand) + cycleReverseKeybind := app.Keybind(commands.SessionChildCycleReverseCommand) + + var navParts []string + if cycleKeybind != "" { + navParts = append(navParts, baseStyle(cycleKeybind)) + } + if cycleReverseKeybind != "" { + navParts = append(navParts, baseStyle(cycleReverseKeybind)) + } + + if len(navParts) > 0 { + body += strings.Join(navParts, mutedStyle(", ")) + mutedStyle(" navigate child sessions") + } } body = defaultStyle(body) default: