diff options
| author | Timo Clasen <[email protected]> | 2025-07-10 22:56:19 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-10 15:56:19 -0500 |
| commit | 982cb3e71ada9b5efc917257ef0dcf5237c34565 (patch) | |
| tree | caf00641127aa281c5db43d5ce0c066b50b0b034 | |
| parent | 294d0e7ee3476f4425c3d21fbaf82dfce3aba017 (diff) | |
| download | opencode-982cb3e71ada9b5efc917257ef0dcf5237c34565.tar.gz opencode-982cb3e71ada9b5efc917257ef0dcf5237c34565.zip | |
fix(tui): center help dilaog (#853)
| -rw-r--r-- | packages/tui/internal/components/dialog/help.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/tui/internal/components/dialog/help.go b/packages/tui/internal/components/dialog/help.go index 4107384f8..51adc3a1c 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, } } |
