stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] [PATCH] Change help functions to use correct number of rows/colu


From: John Li
Subject: [STUMP] [PATCH] Change help functions to use correct number of rows/columns
Date: Mon, 26 May 2008 23:55:44 -0400
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

- display-keybindings didn't count the "Prefix" line when calculating
  the number of columns required
- columnize rounded length/columns down instead of up when calculating
  the number of rows (101 keybindings on 2 columns should use 51 rows)
---
 help.lisp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/help.lisp b/help.lisp
index 1f5ece9..4f27364 100644
--- a/help.lisp
+++ b/help.lisp
@@ -29,7 +29,7 @@

 (defun columnize (list columns &key col-aligns (pad 1) (char #\Space) (align 
:left))
   ;; only somewhat nasty
-  (let* ((rows (truncate (length list) columns))
+  (let* ((rows (ceiling (length list) columns))
          (data (loop for i from 0 below (length list) by rows
                      collect (subseq list i (min (+ i rows) (length list)))))
          (max (mapcar (lambda (col)
@@ -54,7 +54,7 @@
 (defun display-keybinding (kmap-var)
   (let* ((screen (current-screen))
          (data (mapcar-hash (lambda (k v) (format nil "^5*~5a^n ~a" (print-key 
k) v)) (symbol-value kmap-var)))
-         (cols (ceiling (length data)
+         (cols (ceiling (1+ (length data))
                         (truncate (- (head-height (current-head)) (* 2 
(screen-msg-border-width screen)))
                                   (font-height (screen-font screen))))))
     (message-no-timeout "Prefix: ~{~a~^ | ~}~%~{~a~^~%~}"
@@ -69,7 +69,7 @@
   (let* ((screen (current-screen))
          (data (all-commands))
          (cols (ceiling (length data)
-                        (truncate (head-height (current-head))
+                        (truncate (- (head-height (current-head)) (* 2 
(screen-msg-border-width screen)))
                                   (font-height (screen-font screen))))))
     (message-no-timeout "~{~a~^~%~}"
                         (columnize data cols))))
--
1.5.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]