@@ -28,7 +28,10 @@ type CommandType uint
2828// String returns the string representation of the CommandType.
2929func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
3030
31−const sidebarCompactModeBreakpoint = 120
31+const (
32+ sidebarCompactModeBreakpoint = 120
33+ defaultCommandsDialogMaxWidth = 70
34+)
3235
3336const (
3437 SystemCommands CommandType = iota
@@ -238,7 +241,7 @@ func commandsRadioView(sty *styles.Styles, selected CommandType, hasUserCmds boo
238241// Draw implements [Dialog].
239242func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
240243 t := c.com.Styles
241− width := max(0, min(defaultDialogMaxWidth, area.Dx()))
244+ width := max(0, min(defaultCommandsDialogMaxWidth, area.Dx()))
242245 height := max(0, min(defaultDialogHeight, area.Dy()))
243246 if area.Dx() != c.windowWidth && c.selected == SystemCommands {
244247 c.windowWidth = area.Dx()
@@ -254,7 +257,9 @@ func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
254257 t.Dialog.View.GetVerticalFrameSize()
255258
256259 c.input.SetWidth(innerWidth - t.Dialog.InputPrompt.GetHorizontalFrameSize() - 1) // (1) cursor padding
257− c.list.SetSize(innerWidth, height-heightOffset)
260+
261+ listHeight := min(height-heightOffset, c.list.Len())
262+ c.list.SetSize(innerWidth, listHeight)
258263 c.help.SetWidth(innerWidth)
259264
260265 rc := NewRenderContext(t, width)