@@ -505,7 +505,11 @@ func (p *permissionDialogCmp) render() string {
505505 buttons := p .renderButtons ()
506506
507507 // Calculate content height dynamically based on window size
508- p .contentViewPort .Height = p .height - lipgloss .Height (headerContent ) - lipgloss .Height (buttons ) - 2 - lipgloss .Height (title )
508+ // Subtract 3 for the outer frame: border top (1) + border bottom (1) + top padding (1)
509+ // Subtract 2 for the spacer lines between title/header and buttons/bottom
510+ frameOverhead := 3
511+ spacers := 2
512+ p .contentViewPort .Height = max (1 , p .height - frameOverhead - lipgloss .Height (headerContent )- lipgloss .Height (buttons )- spacers - lipgloss .Height (title ))
509513 p .contentViewPort .Width = p .width - 5
510514
511515 // Render content based on tool type
@@ -565,17 +569,17 @@ func (p *permissionDialogCmp) SetSize() tea.Cmd {
565569 }
566570 switch p .permission .ToolName {
567571 case tools .BashToolName :
568- p .width = int (float64 (p .windowSize .Width ) * 0.4 )
569- p .height = int (float64 (p .windowSize .Height ) * 0.3 )
572+ p .width = max ( 40 , int (float64 (p .windowSize .Width )* 0.4 ) )
573+ p .height = max ( 15 , int (float64 (p .windowSize .Height )* 0.4 ) )
570574 case tools .EditToolName , tools .MultiEditToolName :
571575 p .width = int (float64 (p .windowSize .Width ) * 0.8 )
572576 p .height = int (float64 (p .windowSize .Height ) * 0.8 )
573577 case tools .WriteToolName :
574578 p .width = int (float64 (p .windowSize .Width ) * 0.8 )
575579 p .height = int (float64 (p .windowSize .Height ) * 0.8 )
576580 case tools .FetchToolName , tools .WebSearchToolName :
577- p .width = int (float64 (p .windowSize .Width ) * 0.4 )
578- p .height = int (float64 (p .windowSize .Height ) * 0.3 )
581+ p .width = max ( 40 , int (float64 (p .windowSize .Width )* 0.4 ) )
582+ p .height = max ( 15 , int (float64 (p .windowSize .Height )* 0.4 ) )
579583 default :
580584 p .width = int (float64 (p .windowSize .Width ) * 0.7 )
581585 p .height = int (float64 (p .windowSize .Height ) * 0.5 )
@@ -585,6 +589,7 @@ func (p *permissionDialogCmp) SetSize() tea.Cmd {
585589
586590func (p * permissionDialogCmp ) SetPermissions (permission permission.PermissionRequest ) tea.Cmd {
587591 p .permission = permission
592+ p .contentViewPort .GotoTop ()
588593 return p .SetSize ()
589594}
590595
0 commit comments