From 0fea0d59b470ed5691e0ab56d5ca3ed84b2bca4c Mon Sep 17 00:00:00 2001 From: cage Date: Thu, 22 Jul 2021 16:29:51 +0200 Subject: [PATCH] - fixed padding when fitting suggestions into 'suggestion-win'. --- src/tests/text-utils-tests.lisp | 4 ++-- src/text-utils.lisp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tests/text-utils-tests.lisp b/src/tests/text-utils-tests.lisp index d2afbb0..120dab3 100644 --- a/src/tests/text-utils-tests.lisp +++ b/src/tests/text-utils-tests.lisp @@ -30,13 +30,13 @@ (let* ((lines (list "1121" "234" "567")) - (batches (box-fit-multiple-column lines 8 2))) + (batches (box-fit-multiple-column lines 9 2))) batches)) (deftest column-fit (text-utils-suite) (assert-true (tree-equal (column-fit) - '((("1121" "234 ") (" 567" " "))) + '((("1121 " "234 ") ("567 " " "))) :test #'string=))) (deftest column-fit-annotated (text-utils-suite) diff --git a/src/text-utils.lisp b/src/text-utils.lisp index 4bdaf52..9e33563 100644 --- a/src/text-utils.lisp +++ b/src/text-utils.lisp @@ -554,7 +554,12 @@ printed in the box column by column; in the example above the results are: (multiple-value-bind (columns rest-index) (box-fit-as-much-lines-columns lines box-width box-height - :spaces-between spaces-between) + :spaces-between spaces-between + :pad-right-fn + (lambda (a max-width) + (right-padding a (+ max-width + spaces-between))) + :pad-left-fn #'identity) (if rest-index (append (list columns) (box-fit-multiple-column (subseq lines rest-index)