js/src/editline/editline.3

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial