Skip to content

The open source coding agent.

TypeScript

fix(tui): center help dilaog (#853)

Timo Clasen982cb3e71ada
diff --git a/packages/tui/internal/components/dialog/help.go b/packages/tui/internal/components/dialog/help.go
index 4107384f8b5..51adc3a1ce9 100644
--- a/packages/tui/internal/components/dialog/help.go
+++ b/packages/tui/internal/components/dialog/help.go
@@ -30,9 +30,10 @@ func (h *helpDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.WindowSizeMsg:
h.width = msg.Width
h.height = msg.Height
- // Set viewport size with some padding for the modal
- h.viewport = viewport.New(viewport.WithWidth(msg.Width-4), viewport.WithHeight(msg.Height-6))
- h.commandsComponent.SetSize(msg.Width-4, msg.Height-6)
+ // Set viewport size with some padding for the modal, but cap at reasonable width
+ maxWidth := min(80, msg.Width-8)
+ h.viewport = viewport.New(viewport.WithWidth(maxWidth-4), viewport.WithHeight(msg.Height-6))
+ h.commandsComponent.SetSize(maxWidth-4, msg.Height-6)
}
// Update viewport content
@@ -73,7 +74,7 @@ func NewHelpDialog(app *app.App) HelpDialog {
commandsComponent.WithShowAll(true),
commandsComponent.WithKeybinds(true),
),
- modal: modal.New(modal.WithTitle("Help")),
+ modal: modal.New(modal.WithTitle("Help"), modal.WithMaxWidth(80)),
viewport: vp,
}
}