Commit 983dcae
fix(streams): dedup HostWrite against whitespace-normalized pipeline lines
Format-Table / Format-Wide / Format-List output rendered through
Out-String (in Format-McpOutput) and Out-Host (visible terminal)
calculate column padding from different sources — Out-String uses the
IRawUserInterface buffer width (often 120) while Out-Host uses the
actual visible-terminal width. Both renders carry the same data but
inter-column spacing differs by one or more characters per row, e.g.
pipeline section: "AdobeARMservice ADPSvc" (12 sp)
HOST.UI section: "AdobeARMservice ADPSvc" (11 sp)
The existing exact-match HashSet and substring-contain checks both
miss this shape (neither line is a substring of the other), so every
row of a Format-X table that exhibits the drift gets duplicated into
the === HOST.UI (direct) === section.
Add a parallel whitespace-normalized HashSet (consecutive whitespace
runs collapsed to a single space). HostWrite candidate lines are
checked against the exact set first, then the normalized set, then
the substring containment loop. The normalized check catches the
column-width drift cleanly without affecting the existing dedup
paths — legitimate host-UI lines that happen to normalise the same as
a pipeline line are virtually impossible in practice.
Verified on Format-Wide (Get-Service | Format-Wide -Column 4) and
large Format-Table (30+ rows of pscustomobject) — both previously
showed full duplicates in HOST.UI section, now produce a single clean
pipeline-section render. xunit + Pester suites all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8bee551 commit 983dcae
1 file changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
656 | 673 | | |
657 | 674 | | |
658 | 675 | | |
659 | 676 | | |
660 | 677 | | |
661 | | - | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
662 | 682 | | |
663 | 683 | | |
664 | 684 | | |
| |||
667 | 687 | | |
668 | 688 | | |
669 | 689 | | |
| 690 | + | |
| 691 | + | |
670 | 692 | | |
671 | 693 | | |
672 | 694 | | |
| |||
0 commit comments