From owner-freebsd-questions@FreeBSD.ORG Thu Feb 24 20:17:43 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27B23106566B for ; Thu, 24 Feb 2011 20:17:43 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id D05158FC08 for ; Thu, 24 Feb 2011 20:17:42 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pshd5-0008Tt-NZ for freebsd-questions@freebsd.org; Thu, 24 Feb 2011 21:17:39 +0100 Received: from static-87-79-237-121.netcologne.de ([87.79.237.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Feb 2011 21:17:39 +0100 Received: from tg by static-87-79-237-121.netcologne.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 24 Feb 2011 21:17:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Thorsten Glaser Date: Thu, 24 Feb 2011 20:17:21 +0000 (UTC) Lines: 35 Message-ID: References: <20110219233736.GA20393@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 87.79.237.121 (Opera/9.27 (X11; MirBSD i386; U; en)) Subject: Re: variable line-display pager? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2011 20:17:43 -0000 Gary Kline thought.org> writes: > For instance, say that my xterm/console/"Konsole" is 80x53 lines. > My text file is around 200 lines long and I want to use more or less > or some GUI pager to display only 15 lines at one time. Tapping the > space bar would display another 15 lines and so on until EOF. Is mksh-current from CVS comes with a shell function called “smores” which implements “something like” more(1) in (Korn) Shell. You’ll need to press Return though, not Space, to go on. If you replace the word LINES with 15 you get the behaviour you want. The source is here (just look for “smores”): https://www.mirbsd.org/cvs.cgi/src/bin/mksh/dot.mkshrc?rev=HEAD If your mksh is “too old”, you’ll need to replace llen=${%line} (( llen == -1 )) && llen=${#line} with llen=${#line} (since “${%foo} = width of $foo in screen columns” got added only recently, but “${#foo} = size of $foo in octets” has been there for a while) Note that, if you run smores as shell function, it’s aware of whether your current locale is UTF-8 or not (use “set -U” to enable UTF-8 mode, “set +U” to disable it, if you don’t want that). This, again, only affects ${%line} calculation. HTH & HAND, //mirabilos -- Yay for having to rewrite other people's Bash scripts because bash suddenly stopped supporting the bash extensions they make use of -- Tonnerre Lombard in #nosec