Commit 27b0a5c
fix(streams): VT-strip dedup-known set so cmdlet ANSI output stops leaking into HOST.UI
The dedup pass that drops HostWrite lines already present in another
section was comparing VT-stripped \$hostRaw against a HashSet built
from the raw section sources — pipelineText etc. still carried the
SGR codes from cmdlet renderers like AnsiColors.Inserted /
AnsiColors.Deleted. The trim-then-Contains check then mismatched on
the ANSI runs: a HostWrite line of \`: Line 3\` never matched the
known entry \`: \e[31mLine 3\e[0m\`, so every coloured line a
cmdlet emitted leaked into the HOST.UI section as a plain-text
duplicate.
Strip VT codes from each section source before populating \$known.
\$hostRaw is already VT-stripped earlier in the method, so after
this fix both sides of the comparison are normalised the same way
and the duplicate suppression actually fires.
Verified end-to-end against the deployed module: a body that runs
Update-LinesInFile + a WhatIf-bearing Remove-Item now surfaces only
the WhatIf message in HOST.UI; the cmdlet's coloured context /
deleted / inserted / context block stays in pipelineText where it
belongs and no longer echoes into the HOST.UI section.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ded966a commit 27b0a5c
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
579 | 590 | | |
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
583 | | - | |
| 594 | + | |
| 595 | + | |
584 | 596 | | |
585 | 597 | | |
586 | 598 | | |
| |||
0 commit comments