@@ -28,7 +28,10 @@ type CommandType uint
28// String returns the string representation of the CommandType.
28// String returns the string representation of the CommandType.
29func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
29func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
31−const sidebarCompactModeBreakpoint = 120
32+ sidebarCompactModeBreakpoint = 120
33+ defaultCommandsDialogMaxWidth = 70
34 SystemCommands CommandType = iota
37 SystemCommands CommandType = iota
@@ -238,7 +241,7 @@ func commandsRadioView(sty *styles.Styles, selected CommandType, hasUserCmds boo
238// Draw implements [Dialog].
241// Draw implements [Dialog].
239func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
242func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
240 t := c.com.Styles
243 t := c.com.Styles
241− width := max(0, min(defaultDialogMaxWidth, area.Dx()))
244+ width := max(0, min(defaultCommandsDialogMaxWidth, area.Dx()))
242 height := max(0, min(defaultDialogHeight, area.Dy()))
245 height := max(0, min(defaultDialogHeight, area.Dy()))
243 if area.Dx() != c.windowWidth && c.selected == SystemCommands {
246 if area.Dx() != c.windowWidth && c.selected == SystemCommands {
244 c.windowWidth = area.Dx()
247 c.windowWidth = area.Dx()
@@ -254,7 +257,9 @@ func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
254 t.Dialog.View.GetVerticalFrameSize()
257 t.Dialog.View.GetVerticalFrameSize()
256 c.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
259 c.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
257− c.list.SetSize(innerWidth, height-heightOffset)
261+ listHeight := min(height-heightOffset, c.list.Len())
262+ c.list.SetSize(innerWidth, listHeight)
258 c.help.SetWidth(innerWidth)
263 c.help.SetWidth(innerWidth)
260 rc := NewRenderContext(t, width)
265 rc := NewRenderContext(t, width)