From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Holmsand Subject: [PATCH 4/6] Only invoke pager if there's any output Date: Thu, 09 Jun 2005 13:21:26 +0200 Message-ID: <42A82636.1060505@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050609040304070901040903" Cc: Petr Baudis X-From: git-owner@vger.kernel.org Thu Jun 09 14:38:42 2005 Return-path: Received: from vger.kernel.org ([12.107.209.244]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DgM0O-0005g5-Jt for gcvg-git@gmane.org; Thu, 09 Jun 2005 14:19:28 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262371AbVFIMXd (ORCPT ); Thu, 9 Jun 2005 08:23:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262368AbVFIMXd (ORCPT ); Thu, 9 Jun 2005 08:23:33 -0400 Received: from main.gmane.org ([80.91.229.2]:53443 "EHLO ciao.gmane.org") by vger.kernel.org with ESMTP id S262379AbVFIMUH (ORCPT ); Thu, 9 Jun 2005 08:20:07 -0400 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1DgLhu-0002Rm-Sk for git@vger.kernel.org; Thu, 09 Jun 2005 14:00:24 +0200 Received: from 81-224-201-139-no45.tbcn.telia.com ([81.224.201.139]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2005 14:00:22 +0200 Received: from holmsand by 81-224-201-139-no45.tbcn.telia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2005 14:00:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: git@vger.kernel.org X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 81-224-201-139-no45.tbcn.telia.com User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org This is a multi-part message in MIME format. --------------050609040304070901040903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This avoids annoying empty "less" window if there's no output from cg-diff, for example. Signed-off-by: Dan Holmsand --- --------------050609040304070901040903 Content-Type: text/plain; name="4-pager.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="4-pager.patch.txt" cg-Xlib | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/cg-Xlib b/cg-Xlib --- a/cg-Xlib +++ b/cg-Xlib @@ -22,7 +22,11 @@ usage() { } pager () { - LESS="R$LESS" ${PAGER:-less} $PAGER_FLAGS + # Invoke $PAGER if there is any output + local line + if read -r line; then + ( echo "$line"; cat ) | LESS="-R $LESS" ${PAGER:-less} + fi } mktemp () { --------------050609040304070901040903--