]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Improve `notmuch-hello' display on ttys.
authorDavid Edmondson <dme@dme.org>
Tue, 10 Jan 2012 10:15:28 +0000 (10:15 +0000)
committerDavid Bremner <bremner@debian.org>
Fri, 13 Jan 2012 02:33:29 +0000 (22:33 -0400)
Inserting spaces to pad out columns is good, except when the padding
makes the line wider than the window. This looks particularly bad on a
tty where there is no fringe.

Hence, avoid padding the last column on each row.

emacs/notmuch-hello.el

index 333d4c1ea633749cabb7dcf0e31f78241b1eadd2..02017ce59a0ea1fa107aea832b770405274eb429 100644 (file)
@@ -299,15 +299,17 @@ should be. Returns a cons cell `(tags-per-line width)'."
                               :notify #'notmuch-hello-widget-search
                               :notmuch-search-terms query
                               formatted-name)
-               ;; Insert enough space to consume the rest of the
-               ;; column.  Because the button for the name is `(1+
-               ;; (length name))' long (due to the trailing space) we
-               ;; can just insert `(- widest (length name))' spaces -
-               ;; the column separator is included in the button if
-               ;; `(equal widest (length name)'.
-               (widget-insert (make-string (max 1
-                                                (- widest (length name)))
-                                           ? ))))
+               (unless (eq (% count tags-per-line) (1- tags-per-line))
+                 ;; If this is not the last tag on the line, insert
+                 ;; enough space to consume the rest of the column.
+                 ;; Because the button for the name is `(1+ (length
+                 ;; name))' long (due to the trailing space) we can
+                 ;; just insert `(- widest (length name))' spaces - the
+                 ;; column separator is included in the button if
+                 ;; `(equal widest (length name)'.
+                 (widget-insert (make-string (max 1
+                                                  (- widest (length name)))
+                                             ? )))))
            (setq count (1+ count))
            (if (eq (% count tags-per-line) 0)
                (widget-insert "\n")))