1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Improve sqlite-mode--tablify tables

* lisp/sqlite-mode.el (sqlite-mode--tablify): Tweak column widths
and sanitize newlines.
This commit is contained in:
Lars Ingebrigtsen 2021-12-11 06:50:58 +01:00
parent ebf59d1a28
commit fb11575f3c

View file

@ -76,7 +76,7 @@
(when prefix
(insert prefix))
(dotimes (i (length widths))
(insert (propertize (format (format "%%-%ds" (nth i widths))
(insert (propertize (format (format "%%-%ds " (nth i widths))
(nth i columns))
'face 'header-line)))
(insert "\n")
@ -85,11 +85,14 @@
(when prefix
(insert prefix))
(dotimes (i (length widths))
(insert (format (format "%%%s%ds"
(if (numberp (nth i row))
"" "-")
(nth i widths))
(or (nth i row) ""))))
(let ((elem (nth i row)))
(insert (format (format "%%%s%ds "
(if (numberp elem)
"" "-")
(nth i widths))
(if (numberp elem)
(nth i row)
(string-replace "\n" " " (or elem "")))))))
(put-text-property start (point) 'sqlite--row row)
(insert "\n")))))