Prerequisites
Exception report
From https://github.com/carapace-sh/carapace/issues/997#issuecomment-3566731943
PSReadLine's `Complete` logic attempts to auto-complete the input with the "common prefix" of all available matches on the first `<TAB>`. While the actual `CompletionText` differ, Carapace prepends the same ANSI escape codes to the `ListItemText` of every entry to ensure styling. The `Complete` function _correctly_ identifies this ANSI sequence as the shared prefix and prints it to the prompt.
Screenshot
Environment data
PS Version: 7.5.4
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.4.5
PSReadLine EditMode: Windows
OS: 10.0.26100.7306 (WinBuild.160101.0800)
BufferWidth: 158
BufferHeight: 25
Steps to reproduce
Set-PSReadLineKeyHandler -Chord Tab -Function Complete
Register-ArgumentCompleter -Native -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
@(
[System.Management.Automation.CompletionResult]::new("aa", "`e[2maa", [System.Management.Automation.CompletionResultType]::ParameterValue, "1"),
[System.Management.Automation.CompletionResult]::new("bb", "`e[2mbb", [System.Management.Automation.CompletionResultType]::ParameterValue, "2")
)
} -CommandName 'bash'
Expected behavior
Completion should not include ANSI escape sequence
Actual behavior
Escape sequence is completed as part of the arguments
Prerequisites
Exception report
Screenshot
Environment data
Steps to reproduce
Expected behavior
Completion should not include ANSI escape sequence
Actual behavior
Escape sequence is completed as part of the arguments