Skip to content

Commit c7a7fd8

Browse files
committed
fix: prevent text modification when Tab is pressed on execute-only completion items
Execute-only items (e.g., 'Browse files...') with an empty Value would fall through to the text insertion logic, removing the trigger character and inserting a space. Add a guard to close the popup cleanly instead. Assisted-By: docker-agent
1 parent 419b73d commit c7a7fd8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/tui/components/editor/editor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,14 @@ func (e *editor) Update(msg tea.Msg) (layout.Model, tea.Cmd) {
672672
return e, cmd
673673
}
674674

675+
// Execute-only items (e.g., "Browse files...") with no value to insert:
676+
// close the popup without modifying text when Tab is pressed.
677+
if msg.Execute != nil && msg.Value == "" {
678+
e.clearSuggestion()
679+
return e, nil
680+
}
675681
// For non-auto-submit completions OR auto-submit with AutoExecute=false (Tab pressed),
676-
// just insert the text without executing
682+
// just insert the text without executing.
677683
// This allows Tab to autocomplete command text without executing,
678684
// so users can add arguments before pressing Enter to send
679685
currentValue := e.textarea.Value()

0 commit comments

Comments
 (0)