Release 960712
[wine/multimedia.git] / debugger / readline / editline.3
blob1d851ede0fd2c0bbdfe8a232a6540ff9fbc2d6f0
1 .\" $Revision: 1.1 $
2 .TH EDITLINE 3
3 .SH NAME
4 editline \- command-line editing library with history
5 .SH SYNOPSIS
6 .nf
7 .B "char *"
8 .B "readline(prompt)"
9 .B "     char   *prompt;"
11 .B "void"
12 .B "add_history(line)"
13 .B "    char    *line;"
14 .fi
15 .SH DESCRIPTION
16 .I Editline
17 is a library that provides an line-editing interface with text recall.
18 It is intended to be compatible with the
19 .I readline
20 library provided by the Free Software Foundation, but much smaller.
21 The bulk of this manual page describes the user interface.
22 .PP
23 The
24 .I readline
25 routine returns a line of text with the trailing newline removed.
26 The data is returned in a buffer allocated with
27 .IR malloc (3),
28 so the space should be released with
29 .IR free (3)
30 when the calling program is done with it.
31 Before accepting input from the user, the specified
32 .I prompt
33 is displayed on the terminal.
34 .PP
35 The
36 .I add_history
37 routine makes a copy of the specified
38 .I line
39 and adds it to the internal history list.
40 .SS "User Interface"
41 A program that uses this library provides a simple emacs-like editing
42 interface to its users.
43 A line may be edited before it is sent to the calling program by typing either
44 control characters or escape sequences.
45 A control character, shown as a caret followed by a letter, is typed by
46 holding down the ``control'' key while the letter is typed.
47 For example, ``^A'' is a control-A.
48 An escape sequence is entered by typing the ``escape'' key followed by one or
49 more characters.
50 The escape key is abbreviated as ``ESC.''
51 Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
52 is not the same as ``ESC\ f''.
53 .PP
54 An editing command may be typed anywhere on the line, not just at the
55 beginning.
56 In addition, a return may also be typed anywhere on the line, not just at
57 the end.
58 .PP
59 Most editing commands may be given a repeat count,
60 .IR n ,
61 where
62 .I n
63 is a number.
64 To enter a repeat count, type the escape key, the number, and then
65 the command to execute.
66 For example, ``ESC\ 4\ ^f'' moves forward four characters.
67 If a command may be given a repeat count then the text ``[n]'' is given at the
68 end of its description.
69 .PP
70 The following control characters are accepted:
71 .RS
72 .nf
73 .ta \w'ESC DEL  'u
74 ^A      Move to the beginning of the line
75 ^B      Move left (backwards) [n]
76 ^D      Delete character [n]
77 ^E      Move to end of line
78 ^F      Move right (forwards) [n]
79 ^G      Ring the bell
80 ^H      Delete character before cursor (backspace key) [n]
81 ^I      Complete filename (tab key); see below
82 ^J      Done with line (return key)
83 ^K      Kill to end of line (or column [n])
84 ^L      Redisplay line
85 ^M      Done with line (alternate return key)
86 ^N      Get next line from history [n]
87 ^P      Get previous line from history [n]
88 ^R      Search backward (forward if [n]) through history for text;
89 \&      must start line if text begins with an uparrow
90 ^T      Transpose characters
91 ^V      Insert next character, even if it is an edit command
92 ^W      Wipe to the mark
93 ^X^X    Exchange current location and mark
94 ^Y      Yank back last killed text
95 ^[      Start an escape sequence (escape key)
96 ^]c     Move forward to next character ``c''
97 ^?      Delete character before cursor (delete key) [n]
98 .fi
99 .RE
101 The following escape sequences are provided.
104 .ta \w'ESC DEL  'u
105 ESC\ ^H Delete previous word (backspace key) [n]
106 ESC\ DEL        Delete previous word (delete key) [n]
107 ESC\ SP Set the mark (space key); see ^X^X and ^Y above
108 ESC\ \. Get the last (or [n]'th) word from previous line
109 ESC\ \? Show possible completions; see below
110 ESC\ <  Move to start of history
111 ESC\ >  Move to end of history
112 ESC\ b  Move backward a word [n]
113 ESC\ d  Delete word under cursor [n]
114 ESC\ f  Move forward a word [n]
115 ESC\ l  Make word lowercase [n]
116 ESC\ u  Make word uppercase [n]
117 ESC\ y  Yank back last killed text
118 ESC\ v  Show library version
119 ESC\ w  Make area up to mark yankable
120 ESC\ nn Set repeat count to the number nn
121 ESC\ C  Read from environment variable ``_C_'', where C is
122 \&      an uppercase letter
127 .I editline
128 library has a small macro facility.
129 If you type the escape key followed by an uppercase letter,
130 .IR C ,
131 then the contents of the environment variable
132 .I _C_
133 are read in as if you had typed them at the keyboard.
134 For example, if the variable
135 .I _L_
136 contains the following:
138 ^A^Kecho '^V^[[H^V^[[2J'^M
140 Then typing ``ESC L'' will move to the beginning of the line, kill the
141 entire line, enter the echo command needed to clear the terminal (if your
142 terminal is like a VT-100), and send the line back to the shell.
145 .I editline
146 library also does filename completion.
147 Suppose the root directory has the following files in it:
150 .ta \w'core   'u
151 bin     vmunix
152 core    vmunix.old
155 If you type ``rm\ /v'' and then the tab key.
156 .I Editline
157 will then finish off as much of the name as possible by adding ``munix''.
158 Because the name is not unique, it will then beep.
159 If you type the escape key and a question mark, it will display the
160 two choices.
161 If you then type a period and a tab, the library will finish off the filename
162 for you:
165 .RI "rm /v[TAB]" munix .TAB old
168 The tab key is shown by ``[TAB]'' and the automatically-entered text
169 is shown in italics.
170 .SH "BUGS AND LIMITATIONS"
171 Cannot handle lines more than 80 columns.
172 .SH AUTHORS
173 Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
174 and Rich $alz <rsalz@osf.org>.
175 Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.