cl-ansi-term
cl-ansi-term copied to clipboard
Table function should calculate width for every column before outputting it to the screen [DONE]
Here is example where table is broken:
POFTHEDAY> (term:table '(("name" "age" "email")
("me" 7 "some@blah")
("me" 7 "[email protected]")))
+---------+---------+---------+
|name |age |email |
+---------+---------+---------+
|me |7 |some@blah|
+---------+---------+---------+
|me |7 |[email protected]|
+---------+---------+---------+
thanks for the tests and reports. To make it fit now we have to expand all columns width:
(term:table '(("name" "age" "email")
("me" 7 "some@blah")
("me" 7 "[email protected]"))
:column-width 30)
+-----------------------------+-----------------------------+-----------------------------+
|name |age |email |
+-----------------------------+-----------------------------+-----------------------------+
|me |7 |some@blah |
+-----------------------------+-----------------------------+-----------------------------+
|me |7 |[email protected] |
+-----------------------------+-----------------------------+-----------------------------+
I'll want to evaluate if https://github.com/telephil/cl-ascii-table/ is overall better at printing tables…
I got this fixed:
;; A long cell is truncated to :column-width, 10 by default.
(term:table '(("name" "age" "email")
("me" 7 "some@blah")
("me" 7 "[email protected]")))
+---------+---------+---------+
|name |age |email |
+---------+---------+---------+
|me |7 |some@blah|
+---------+---------+---------+
|me |7 |some@w(…)|
+---------+---------+---------+
;; Each column can have a different length.
(term:table '(("name" "age" "email")
("me" 7 "some@blah")
("me" 7 "[email protected]"))
:column-width '(10 4 20))
+---------+---+-------------------+
|name |age|email |
+---------+---+-------------------+
|me |7 |some@blah |
+---------+---+-------------------+
|me |7 |some@with-some-l(…)|
+---------+---+-------------------+
however
calculate width for every column
probably.
Having an automatic column width calculation is a nice feature. Cl-ASCII-TABLE does this.