xref: /freebsd/contrib/dialog/samples/editbox4 (revision 4c8945a06b01a5c8122cdeb402af36bb46a06acc)
1*4c8945a0SNathan Whitehorn#!/bin/sh
2*4c8945a0SNathan Whitehorn# $Id: editbox4,v 1.1 2010/01/17 22:29:50 tom Exp $
3*4c8945a0SNathan Whitehorn
4*4c8945a0SNathan Whitehorn. ./setup-vars
5*4c8945a0SNathan Whitehorn
6*4c8945a0SNathan WhitehornDIALOG_ERROR=254
7*4c8945a0SNathan Whitehornexport DIALOG_ERROR
8*4c8945a0SNathan Whitehorn
9*4c8945a0SNathan Whitehorn. ./setup-edit
10*4c8945a0SNathan Whitehorn
11*4c8945a0SNathan Whitehorncat << EOF > $input
12*4c8945a0SNathan WhitehornHi, this is an edit box. It can be used to edit text from a file.
13*4c8945a0SNathan Whitehorn
14*4c8945a0SNathan WhitehornIt's like a simple text editor, with these keys implemented:
15*4c8945a0SNathan Whitehorn
16*4c8945a0SNathan WhitehornPGDN	- Move down one page
17*4c8945a0SNathan WhitehornPGUP	- Move up one page
18*4c8945a0SNathan WhitehornDOWN	- Move down one line
19*4c8945a0SNathan WhitehornUP	- Move up one line
20*4c8945a0SNathan WhitehornDELETE	- Delete the current character
21*4c8945a0SNathan WhitehornBACKSPC	- Delete the previous character
22*4c8945a0SNathan Whitehorn
23*4c8945a0SNathan WhitehornUnlike Xdialog, it does not do these:
24*4c8945a0SNathan Whitehorn
25*4c8945a0SNathan WhitehornCTRL C	- Copy text
26*4c8945a0SNathan WhitehornCTRL V	- Paste text
27*4c8945a0SNathan Whitehorn
28*4c8945a0SNathan WhitehornBecause dialog normally uses TAB for moving between fields,
29*4c8945a0SNathan Whitehornthis editbox uses CTRL/V as a literal-next character.  You
30*4c8945a0SNathan Whitehorncan enter TAB characters by first pressing CTRL/V.  This
31*4c8945a0SNathan Whitehornexample contains a few tab characters.
32*4c8945a0SNathan Whitehorn
33*4c8945a0SNathan WhitehornIt supports the mouse - but only for positioning in the editbox,
34*4c8945a0SNathan Whitehornor for clicking on buttons.  Your terminal (emulator) may support
35*4c8945a0SNathan Whitehorncut/paste.
36*4c8945a0SNathan Whitehorn
37*4c8945a0SNathan WhitehornTry to input some text below:
38*4c8945a0SNathan Whitehorn
39*4c8945a0SNathan WhitehornEOF
40*4c8945a0SNathan Whitehorn
41*4c8945a0SNathan Whitehorn$DIALOG --title "EDIT BOX" \
42*4c8945a0SNathan Whitehorn	--fixed-font "$@" --editbox $input 20 40 2>$output
43*4c8945a0SNathan Whitehornretval=$?
44*4c8945a0SNathan Whitehorn
45*4c8945a0SNathan Whitehorn. ./report-edit
46