@@ -79,10 +79,18 @@ func (p *permissionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7979 p .isViewportFocus = ! p .isViewportFocus
8080 if p .isViewportFocus {
8181 p .selectOption .Blur ()
82+ // Add a visual indicator for focus change
83+ cmds = append (cmds , tea .Batch (
84+ util .CmdHandler (util .InfoMsg ("Viewing content - use arrow keys to scroll" )),
85+ ))
8286 } else {
8387 p .selectOption .Focus ()
88+ // Add a visual indicator for focus change
89+ cmds = append (cmds , tea .Batch (
90+ util .CmdHandler (util .InfoMsg ("Select an action" )),
91+ ))
8492 }
85- return p , nil
93+ return p , tea . Batch ( cmds ... )
8694 }
8795 }
8896
@@ -133,34 +141,55 @@ func (p *permissionDialogCmp) render() string {
133141 case tools .BashToolName :
134142 pr := p .permission .Params .(tools.BashPermissionsParams )
135143 headerParts = append (headerParts , keyStyle .Render ("Command:" ))
136- content , _ = r . Render ( fmt .Sprintf ("```bash\n %s\n ```" , pr .Command ) )
144+ content = fmt .Sprintf ("```bash\n %s\n ```" , pr .Command )
137145 case tools .EditToolName :
138146 pr := p .permission .Params .(tools.EditPermissionsParams )
139147 headerParts = append (headerParts , keyStyle .Render ("Update" ))
140- content , _ = r . Render ( fmt .Sprintf ("```diff \n %s\n ```" , pr .Diff ) )
148+ content = fmt .Sprintf ("```\n %s\n ```" , pr .Diff )
141149 case tools .WriteToolName :
142150 pr := p .permission .Params .(tools.WritePermissionsParams )
143151 headerParts = append (headerParts , keyStyle .Render ("Content" ))
144- content , _ = r . Render ( fmt .Sprintf ("```diff \n %s\n ```" , pr .Content ) )
152+ content = fmt .Sprintf ("```\n %s\n ```" , pr .Content )
145153 case tools .FetchToolName :
146154 pr := p .permission .Params .(tools.FetchPermissionsParams )
147155 headerParts = append (headerParts , keyStyle .Render ("URL: " + pr .URL ))
148156 default :
149- content , _ = r . Render ( p .permission .Description )
157+ content = p .permission .Description
150158 }
159+
160+ renderedContent , _ := r .Render (content )
151161 headerContent := lipgloss .NewStyle ().Padding (0 , 1 ).Render (lipgloss .JoinVertical (lipgloss .Left , headerParts ... ))
152162 p .contentViewPort .Width = p .width - 2 - 2
153163 p .contentViewPort .Height = p .height - lipgloss .Height (headerContent ) - lipgloss .Height (form ) - 2 - 2 - 1
154- p .contentViewPort .SetContent (content )
155- contentBorder := lipgloss .RoundedBorder ()
164+ p .contentViewPort .SetContent (renderedContent )
165+
166+ // Make focus change more apparent with different border styles and colors
167+ var contentBorder lipgloss.Border
168+ var borderColor lipgloss.TerminalColor
169+
156170 if p .isViewportFocus {
157171 contentBorder = lipgloss .DoubleBorder ()
172+ borderColor = styles .Blue
173+ } else {
174+ contentBorder = lipgloss .RoundedBorder ()
175+ borderColor = styles .Flamingo
176+ }
177+
178+ contentStyle := lipgloss .NewStyle ().
179+ MarginTop (1 ).
180+ Padding (0 , 1 ).
181+ Border (contentBorder ).
182+ BorderForeground (borderColor )
183+
184+ if p .isViewportFocus {
185+ contentStyle = contentStyle .BorderBackground (styles .Surface0 )
158186 }
159- cotentStyle := lipgloss . NewStyle (). MarginTop ( 1 ). Padding ( 0 , 1 ). Border ( contentBorder ). BorderForeground ( styles . Flamingo )
160- contentFinal := cotentStyle .Render (p .contentViewPort .View ())
161- if content == "" {
187+
188+ contentFinal := contentStyle .Render (p .contentViewPort .View ())
189+ if renderedContent == "" {
162190 contentFinal = ""
163191 }
192+
164193 return lipgloss .JoinVertical (
165194 lipgloss .Top ,
166195 headerContent ,
@@ -241,12 +270,13 @@ func NewPermissionDialogCmd(permission permission.PermissionRequest) tea.Cmd {
241270 minWidth := 100
242271 minHeight := 30
243272
273+ // Make the dialog size more appropriate for bash commands
244274 switch permission .ToolName {
245275 case tools .BashToolName :
246- widthRatio = 0.5
247- heightRatio = 0.3
248- minWidth = 80
249- minHeight = 20
276+ widthRatio = 0.7
277+ heightRatio = 0.5
278+ minWidth = 100
279+ minHeight = 30
250280 }
251281 // Return the dialog command
252282 return util .CmdHandler (core.DialogMsg {
0 commit comments