unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: Improve `notmuch-hello' display on ttys.
Date: Tue, 10 Jan 2012 10:15:28 +0000	[thread overview]
Message-ID: <1326190528-3548-1-git-send-email-dme@dme.org> (raw)

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

             reply	other threads:[~2012-01-10 10:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10 10:15 David Edmondson [this message]
2012-01-10 15:36 ` [PATCH] emacs: Improve `notmuch-hello' display on ttys 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326190528-3548-1-git-send-email-dme@dme.org \
    --to=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).