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