Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8FFEC431FD0 for ; Tue, 10 Jan 2012 12:07:34 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jGYJkWL4kQ70 for ; Tue, 10 Jan 2012 12:07:34 -0800 (PST) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id CD585431FB6 for ; Tue, 10 Jan 2012 12:07:33 -0800 (PST) Received: by eeke51 with SMTP id e51so601006eek.26 for ; Tue, 10 Jan 2012 12:07:32 -0800 (PST) Received: by 10.213.23.11 with SMTP id p11mr586889ebb.75.1326226051102; Tue, 10 Jan 2012 12:07:31 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi. [80.220.92.23]) by mx.google.com with ESMTPS id 19sm132228483eew.7.2012.01.10.12.07.27 (version=SSLv3 cipher=OTHER); Tue, 10 Jan 2012 12:07:28 -0800 (PST) From: Jani Nikula To: David Edmondson , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: Improve `notmuch-hello' display on ttys. In-Reply-To: <1326190528-3548-1-git-send-email-dme@dme.org> References: <1326190528-3548-1-git-send-email-dme@dme.org> User-Agent: Notmuch/0.10.2+180~g33b8a00 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Tue, 10 Jan 2012 22:07:26 +0200 Message-ID: <8762gjs4n5.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 20:07:34 -0000 On Tue, 10 Jan 2012 10:15:28 +0000, David Edmondson wrote: > 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. Thanks for fixing this. This patch works for me. BR, j4ni. > > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch