xref: /freebsd/contrib/dialog/samples/textbox2 (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
14c8945a0SNathan Whitehorn#!/bin/sh
2*a96ef450SBaptiste Daroussin# $Id: textbox2,v 1.10 2020/11/26 00:05:52 tom Exp $
34c8945a0SNathan Whitehorn
44c8945a0SNathan Whitehorn. ./setup-vars
54c8945a0SNathan Whitehorn
64c8945a0SNathan Whitehorn. ./setup-tempfile
74c8945a0SNathan Whitehorn
84c8945a0SNathan Whitehorncat << EOF > $tempfile
94c8945a0SNathan WhitehornHi, this is a text dialog box. It can be used to display text from a file.
104c8945a0SNathan WhitehornThe file should not contain any 'tab' characters, so you should 'expand'
114c8945a0SNathan Whitehornthe file first if it contains 'tab' characters.
124c8945a0SNathan Whitehorn
134c8945a0SNathan WhitehornIt's like a simple text file viewer, with these keys implemented:
144c8945a0SNathan Whitehorn
154c8945a0SNathan WhitehornPGDN/SPACE     - Move down one page
164c8945a0SNathan WhitehornPGUP/'b'       - Move up one page
174c8945a0SNathan WhitehornENTER/DOWN/'j' - Move down one line
184c8945a0SNathan WhitehornUP/'k'         - Move up one line
194c8945a0SNathan WhitehornLEFT/'h'       - Scroll left
204c8945a0SNathan WhitehornRIGHT/'l'      - Scroll right
214c8945a0SNathan Whitehorn'0'            - Move to beginning of line
224c8945a0SNathan WhitehornHOME/'g'       - Move to beginning of file
234c8945a0SNathan WhitehornEND/'G'        - Move to end of file
244c8945a0SNathan Whitehorn'/'            - Forward search
254c8945a0SNathan Whitehorn'?'            - Backward search
264c8945a0SNathan Whitehorn'n'            - Repeat last search (forward)
274c8945a0SNathan Whitehorn'N'            - Repeat last search (backward)
284c8945a0SNathan Whitehorn
294c8945a0SNathan Whitehorn
304c8945a0SNathan WhitehornThe following is a sample text file:
314c8945a0SNathan Whitehorn
324c8945a0SNathan Whitehorn
334c8945a0SNathan WhitehornEOF
344c8945a0SNathan Whitehorn
354c8945a0SNathan WhitehornTEXT=/usr/share/common-licenses/GPL
364c8945a0SNathan Whitehorntest -f $TEXT || TEXT=../COPYING
374c8945a0SNathan Whitehorn
38*a96ef450SBaptiste Daroussinexpand < $TEXT >> $tempfile
394c8945a0SNathan Whitehorn
404c8945a0SNathan Whitehorn$DIALOG --clear --title "TEXT BOX" "$@" --textbox "$tempfile" 0 0
414c8945a0SNathan Whitehorn
42*a96ef450SBaptiste Daroussinreturncode=$?
434c8945a0SNathan Whitehorn
444c8945a0SNathan Whitehorn. ./report-button
45