]> gitweb.factorcode.org Git - factor.git/commitdiff
FUEL: fix in table rendering, previously it cutted off some cells with to much text 1166/head
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 21 Oct 2014 21:20:47 +0000 (23:20 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Tue, 21 Oct 2014 21:20:47 +0000 (23:20 +0200)
misc/fuel/fuel-table.el

index 1a7e56e7e7ab28174cc617dbcc3874f175fc90c0..40b9abeff0b869d29f5780baa98f3c303d07543a 100644 (file)
         (mapcar #'(lambda (s) (fuel-table--pad-str s width))
                 (split-string (buffer-string) "\n"))))))
 
+(defun fuel-table--pad-cell (lines max-ln)
+  (let* ((ln (length lines))
+         (blank (make-string (length (car lines)) ?\ ))
+         (n-extra (max (- max-ln ln) 0)))
+    (append lines (make-list n-extra blank))))
+
 (defun fuel-table--pad-row (row)
   (let* ((max-ln (apply 'max (mapcar 'length row)))
          (result))
     (dolist (lines row)
-      (let ((ln (length lines)))
-        (if (= ln max-ln) (push lines result)
-          (let ((lines (reverse lines))
-                (l 0)
-                (blank (make-string (length (car lines)) ?\ )))
-            (while (< l ln)
-              (push blank lines)
-              (setq l (1+ l)))
-            (push (reverse lines) result)))))
+      (push (fuel-table--pad-cell lines max-ln) result))
     (reverse result)))
 
 (defun fuel-table--format-rows (rows widths)