ConsoleGuiTools icon indicating copy to clipboard operation
ConsoleGuiTools copied to clipboard

Request: Control over how columns are collapsed/truncated

Open LarsFosdal opened this issue 4 years ago • 2 comments

Example: The two last columns contain long paths that typically only differ at the end.

image

It would be nice if you could select if columns should be collapsed/truncated from left or right and at a fixed length. Get-SourceData | Select-Object FactoryNo, LocationName, StagingPath, CentralUpgradeOverrideDir | Out-ConsoleGridUI -passthru -ColumnWidth 3, 20, -20, -30 Reserving 3 and 20 chars for the first and second column, and 20 and 30 chars for the third and fourth column with the - sign indicating that the truncation should be on the left side.

Alternatively, offer a parameter with strings that the display would collapse: Get-SourceData | Select-Object FactoryNo, LocationName, StagingPath, CentralUpgradeOverrideDir | Out-ConsoleGridUI -passthru -collapse "\\app100213\Staging", "\\tine.no\applikasjon\TINE_WMS"

Note that only the display should collapse/truncate while the actual values should be passed on in their original length.

LarsFosdal avatar Mar 20 '20 09:03 LarsFosdal

Best way to have a scrolling in column but it is difficult to implement.

iSazonov avatar Mar 20 '20 09:03 iSazonov

Some other options to consider:

  1. Eliminate some cruft columns: do you really need 3 columns for the checkbox? It's ok to have a √ character next to an item to indicate it's selected.
  2. Show ellipses … at the end of a value that has been truncated (or the beginning - I like @LarsFosdal's left-truncation idea). Some terminals may not support the single-character ellipses, and using three dots would probably exacerbate the truncation problem. For these cases a single dot could indicate truncation.
  3. Choose a different algorithm for determining max column width to eliminate truncation. Check all the visible values' length instead of half of them. It can be visually jarring to have columns resize when you scroll, but it's a simpler implementation than many others.
  4. Allow horizontal scroll when the width is wider than the visible portal. It's not ideal, but it works like Out-GridView.
  5. Truncate like Jexer does, with a ~ and the last few letters of the filename.

Note: I considered vertical scrolling when I wrote AsciiMenu.ps1. The scroll thumb algorithm was difficult to write and might be reusable. Feel free to use that code if it suits your purpose.

mossrich avatar May 18 '21 18:05 mossrich

@andschwa This should be closed as won't fix since it's for the Avalona version.

tig avatar Aug 24 '22 12:08 tig