unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Improve `notmuch-hello' display on ttys.
@ 2012-01-10 10:15 David Edmondson
  2012-01-10 15:36 ` Austin Clements
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: David Edmondson @ 2012-01-10 10:15 UTC (permalink / raw)
  To: notmuch

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.
---

Thanks to j4ni in #notmuch for spotting this.

 emacs/notmuch-hello.el |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 333d4c1..02017ce 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -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")))
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-01-13  2:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10 10:15 [PATCH] emacs: Improve `notmuch-hello' display on ttys David Edmondson
2012-01-10 15:36 ` Austin Clements
2012-01-10 15:47   ` David Edmondson
2012-01-10 16:05     ` Austin Clements
2012-01-10 16:18       ` David Edmondson
     [not found]         ` <87zkdvffxu.fsf@nikula.org>
2012-01-10 20:45           ` Jani Nikula
2012-01-11  8:27             ` David Edmondson
2012-01-11 18:25               ` Ivy Foster
2012-01-10 20:07 ` Jani Nikula
2012-01-11 22:46 ` Xavier Maillard
2012-01-13  2:51 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).