Timo Clasen 7 месяцев назад
Родитель
Сommit
982cb3e71a
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      packages/tui/internal/components/dialog/help.go

+ 5 - 4
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,
 	}
 }