This project is read-only.

Calculated Width is still wrong --- causing awkward wrapping


The host is still calculating the width wrong that it gives to PowerShell. The output of this shouldn't wrap, but does:

"A" * $Host.UI.RawUI.WindowSize.Width


nsulikow wrote Jan 24, 2012 at 11:17 PM

I wonder if the solution to this would be to return a very large width (say 10000).... since the RichTextBox control would already take care of wrapping long lines...

Jaykul wrote Jan 25, 2012 at 12:15 AM

I tried that initially, but it totally wrecks the output when it's table formatted. To see what I mean try piping through Out-String -Width 10000

nsulikow wrote Jan 26, 2012 at 6:10 AM

Good point. I think there is something weird in the code, as the character width seems to be hardcoded. I would explore using System.Windows.Media.TextFormatting.TextFormatter to calculate the text width...

nsulikow wrote Jan 26, 2012 at 4:41 PM

Sorry, I meant: FormattedText