fix: clear suggestion ghost text when completion dialog closes on backspace#2399
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 13, 2026
Conversation
…kspace When typing '/' to open the completion dialog, the first item (e.g. /attach) was shown as ghost text. Pressing backspace correctly removed the '/' and closed the dialog, but the ghost text 'attach' remained visible in the editor. The root cause was a timing issue: updateCompletionQuery sent an async CloseMsg but didn't clear the suggestion immediately. Meanwhile, refreshSuggestion returned early (without clearing) because currentCompletion was still set. Fix: clear the suggestion synchronously in updateCompletionQuery when closing the completion popup. Also simplify the suggestion management code: - Consolidate 5 clearSuggestion calls in refreshSuggestion into one - Simplify SelectionChangedMsg with a clear-first-then-set pattern - Remove redundant clearSuggestion in ClosedMsg handler Assisted-By: docker-agent
aheritier
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When typing
/to open the completion dialog, the first item (e.g./attach) was shown as ghost text. Pressing backspace correctly removed the/and closed the dialog, but the ghost textattachremained visible in the editor.Root Cause
A timing issue:
updateCompletionQuerysent an asyncCloseMsgbut didn't clear the suggestion immediately. Meanwhile,refreshSuggestionreturned early (without clearing) becausecurrentCompletionwas still set.Fix
Clear the suggestion synchronously in
updateCompletionQuerywhen closing the completion popup.Also simplify the suggestion management code:
clearSuggestioncalls inrefreshSuggestioninto oneSelectionChangedMsgwith a clear-first-then-set patternclearSuggestioninClosedMsghandlerNet: +9 / -33 lines