mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
fix: keybind panic (#2092)
This commit is contained in:
@@ -207,6 +207,9 @@ func New(
|
|||||||
|
|
||||||
func (a *App) Keybind(commandName commands.CommandName) string {
|
func (a *App) Keybind(commandName commands.CommandName) string {
|
||||||
command := a.Commands[commandName]
|
command := a.Commands[commandName]
|
||||||
|
if len(command.Keybindings) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
kb := command.Keybindings[0]
|
kb := command.Keybindings[0]
|
||||||
key := kb.Key
|
key := kb.Key
|
||||||
if kb.RequiresLeader {
|
if kb.RequiresLeader {
|
||||||
|
|||||||
@@ -671,10 +671,22 @@ func renderToolDetails(
|
|||||||
body = strings.Join(steps, "\n")
|
body = strings.Join(steps, "\n")
|
||||||
|
|
||||||
body += "\n\n"
|
body += "\n\n"
|
||||||
body += baseStyle(app.Keybind(commands.SessionChildCycleCommand)) +
|
|
||||||
mutedStyle(", ") +
|
// Build navigation hint with proper spacing
|
||||||
baseStyle(app.Keybind(commands.SessionChildCycleReverseCommand)) +
|
cycleKeybind := app.Keybind(commands.SessionChildCycleCommand)
|
||||||
mutedStyle(" navigate child sessions")
|
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)
|
body = defaultStyle(body)
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user