1
2
3
4
5
6
7 package jline;
8
9 import java.awt.event.KeyEvent;
10
11 /***
12 * Symbolic constants for Console operations and virtual key bindings.
13 * @see KeyEvent
14 *
15 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
16 */
17 public interface ConsoleOperations {
18 final String CR = System.getProperty("line.separator");
19 final char BACKSPACE = '\b';
20 final char RESET_LINE = '\r';
21 final char KEYBOARD_BELL = '\07';
22 final char CTRL_A = 1;
23 final char CTRL_B = 2;
24 final char CTRL_C = 3;
25 final char CTRL_D = 4;
26 final char CTRL_E = 5;
27 final char CTRL_F = 6;
28 final static char CTRL_K = 11;
29 final static char CTRL_L = 12;
30 final char CTRL_N = 14;
31 final char CTRL_P = 16;
32 final static char CTRL_OB = 27;
33 final static char DELETE = 127;
34 final static char CTRL_QM = 127;
35
36
37 /***
38 * Logical constants for key operations.
39 */
40
41 /***
42 * Unknown operation.
43 */
44 final short UNKNOWN = -99;
45
46 /***
47 * Operation that moves to the beginning of the buffer.
48 */
49 final short MOVE_TO_BEG = -1;
50
51 /***
52 * Operation that moves to the end of the buffer.
53 */
54 final short MOVE_TO_END = -3;
55
56 /***
57 * Operation that moved to the previous character in the buffer.
58 */
59 final short PREV_CHAR = -4;
60
61 /***
62 * Operation that issues a newline.
63 */
64 final short NEWLINE = -6;
65
66 /***
67 * Operation that deletes the buffer from the current character to the end.
68 */
69 final short KILL_LINE = -7;
70
71 /***
72 * Operation that clears the screen.
73 */
74 final short CLEAR_SCREEN = -8;
75
76 /***
77 * Operation that sets the buffer to the next history item.
78 */
79 final short NEXT_HISTORY = -9;
80
81 /***
82 * Operation that sets the buffer to the previous history item.
83 */
84 final short PREV_HISTORY = -11;
85
86 /***
87 * Operation that redisplays the current buffer.
88 */
89 final short REDISPLAY = -13;
90
91 /***
92 * Operation that deletes the buffer from the cursor to the beginning.
93 */
94 final short KILL_LINE_PREV = -15;
95
96 /***
97 * Operation that deletes the previous word in the buffer.
98 */
99 final short DELETE_PREV_WORD = -16;
100
101 /***
102 * Operation that moves to the next character in the buffer.
103 */
104 final short NEXT_CHAR = -19;
105
106 /***
107 * Operation that moves to the previous character in the buffer.
108 */
109 final short REPEAT_PREV_CHAR = -20;
110
111 /***
112 * Operation that searches backwards in the command history.
113 */
114 final short SEARCH_PREV = -21;
115
116 /***
117 * Operation that repeats the character.
118 */
119 final short REPEAT_NEXT_CHAR = -24;
120
121 /***
122 * Operation that searches forward in the command history.
123 */
124 final short SEARCH_NEXT = -25;
125
126 /***
127 * Operation that moved to the previous whitespace.
128 */
129 final short PREV_SPACE_WORD = -27;
130
131 /***
132 * Operation that moved to the end of the current word.
133 */
134 final short TO_END_WORD = -29;
135
136 /***
137 * Operation that
138 */
139 final short REPEAT_SEARCH_PREV = -34;
140
141 /***
142 * Operation that
143 */
144 final short PASTE_PREV = -36;
145
146 /***
147 * Operation that
148 */
149 final short REPLACE_MODE = -37;
150
151 /***
152 * Operation that
153 */
154 final short SUBSTITUTE_LINE = -38;
155
156 /***
157 * Operation that
158 */
159 final short TO_PREV_CHAR = -39;
160
161 /***
162 * Operation that
163 */
164 final short NEXT_SPACE_WORD = -40;
165
166 /***
167 * Operation that
168 */
169 final short DELETE_PREV_CHAR = -41;
170
171 /***
172 * Operation that
173 */
174 final short ADD = -42;
175
176 /***
177 * Operation that
178 */
179 final short PREV_WORD = -43;
180
181 /***
182 * Operation that
183 */
184 final short CHANGE_META = -44;
185
186 /***
187 * Operation that
188 */
189 final short DELETE_META = -45;
190
191 /***
192 * Operation that
193 */
194 final short END_WORD = -46;
195
196 /***
197 * Operation that toggles insert/overtype
198 */
199 final short INSERT = -48;
200
201 /***
202 * Operation that
203 */
204 final short REPEAT_SEARCH_NEXT = -49;
205
206 /***
207 * Operation that
208 */
209 final short PASTE_NEXT = -50;
210
211 /***
212 * Operation that
213 */
214 final short REPLACE_CHAR = -51;
215
216 /***
217 * Operation that
218 */
219 final short SUBSTITUTE_CHAR = -52;
220
221 /***
222 * Operation that
223 */
224 final short TO_NEXT_CHAR = -53;
225
226 /***
227 * Operation that undoes the previous operation.
228 */
229 final short UNDO = -54;
230
231 /***
232 * Operation that moved to the next word.
233 */
234 final short NEXT_WORD = -55;
235
236 /***
237 * Operation that deletes the previous character.
238 */
239 final short DELETE_NEXT_CHAR = -56;
240
241 /***
242 * Operation that toggles between uppercase and lowercase.
243 */
244 final short CHANGE_CASE = -57;
245
246 /***
247 * Operation that performs completion operation on the current word.
248 */
249 final short COMPLETE = -58;
250
251 /***
252 * Operation that exits the command prompt.
253 */
254 final short EXIT = -59;
255
256 /***
257 * Operation that pastes the contents of the clipboard into the line
258 */
259 final short PASTE = -60;
260
261 /***
262 * Operation that moves the current History to the beginning.
263 */
264 final static short START_OF_HISTORY = -61;
265
266 /***
267 * Operation that moves the current History to the end.
268 */
269 final static short END_OF_HISTORY = -62;
270
271 /***
272 * Operation that clears whatever text is on the current line.
273 */
274 final static short CLEAR_LINE = -63;
275
276 }