xref: /freebsd/contrib/dialog/samples/editbox (revision aca5021d5f7dcab1e11692923266373e35322d9a)
1#!/bin/sh
2# $Id: editbox,v 1.13 2010/01/13 10:20:03 tom Exp $
3
4. ./setup-vars
5
6DIALOG_ERROR=254
7export DIALOG_ERROR
8
9. ./setup-edit
10
11cat << EOF > $input
12Hi, this is an edit box. It can be used to edit text from a file.
13
14It's like a simple text editor, with these keys implemented:
15
16PGDN	- Move down one page
17PGUP	- Move up one page
18DOWN	- Move down one line
19UP	- Move up one line
20DELETE	- Delete the current character
21BACKSPC	- Delete the previous character
22
23Unlike Xdialog, it does not do these:
24
25CTRL C	- Copy text
26CTRL V	- Paste text
27
28Because dialog normally uses TAB for moving between fields,
29this editbox uses CTRL/V as a literal-next character.  You
30can enter TAB characters by first pressing CTRL/V.  This
31example contains a few tab characters.
32
33It supports the mouse - but only for positioning in the editbox,
34or for clicking on buttons.  Your terminal (emulator) may support
35cut/paste.
36
37Try to input some text below:
38
39EOF
40
41$DIALOG --title "EDIT BOX" \
42	--fixed-font "$@" --editbox $input 0 0 2>$output
43retval=$?
44
45. ./report-edit
46