timoxley/columnify

Preserve All Whitespace

shellscape opened this issue · 2 comments

Since the module doesn't have configuration (ala text-table) for leading whitespace or space between columns, collapsing all whitespace is problematic. We're left to hack around it by splitting lines for leading whitespace, and we're hosed if we want to configure the whitespace between columns. We can't always know what the minimum width of a column should be, after all.

An option to either preserve (eg. not collapse) whitespace or options for leading and between-column whitespace is sorely needed.

Personally I would simply like a padding on the entire column. AKA: add \t\t at the start of every line so that the columns can appear indented on the screen when needed.

Found a hack which works!

dataTransform: (s: string) => s.replace(" ", "\u2063")

\u2063 is an 'invisible separator' (ie an invisible comma) and is not matched by the \s regex here