Skip to content

Commit cba103a

Browse files
committed
updated script
1 parent d177233 commit cba103a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Helper/TableLayout.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public function formatRow($texts, $colors = array(), $columnWidths = array(), $c
138138
}
139139
$chunks[] = $chunk;
140140
}
141-
$out[] = implode($this->separator, $chunks);
141+
$out[] = (empty($this->separator) || $this->separator == ' ')
142+
? implode($this->separator, $chunks)
143+
: $this->separator . implode($this->separator, $chunks) . $this->separator;
142144
}
143145

144146
return implode(StdIO::LF, $out);
@@ -155,7 +157,10 @@ public function formatRow($texts, $colors = array(), $columnWidths = array(), $c
155157
*/
156158
protected function calculateColLengths($columnWidths) {
157159
$idx = 0;
158-
$fixed = (count($columnWidths) - 1) * $this->strlen($this->separator); // separator are used already
160+
// separator are used already
161+
$fixed = (empty($this->separator) || $this->separator == ' ')
162+
? (count($columnWidths) - 1) * $this->strlen($this->separator)
163+
: (count($columnWidths) + 1) * $this->strlen($this->separator);
159164
$fluid = -1;
160165

161166
// first pass for format check and fixed columns

0 commit comments

Comments
 (0)