PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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