001 /*
002 * Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved.
003 *
004 * This software is distributable under the BSD license. See the terms of the
005 * BSD license in the documentation provided with this software.
006 */
007 package jline;
008
009 import java.awt.event.KeyEvent;
010
011 /**
012 * Symbolic constants for Console operations and virtual key bindings.
013 * @see KeyEvent
014 *
015 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
016 */
017 public interface ConsoleOperations {
018 final String CR = System.getProperty("line.separator");
019 final char BACKSPACE = '\b';
020 final char RESET_LINE = '\r';
021 final char KEYBOARD_BELL = '\07';
022 final char CTRL_A = 1;
023 final char CTRL_B = 2;
024 final char CTRL_C = 3;
025 final char CTRL_D = 4;
026 final char CTRL_E = 5;
027 final char CTRL_F = 6;
028 final static char CTRL_K = 11;
029 final static char CTRL_L = 12;
030 final char CTRL_N = 14;
031 final char CTRL_P = 16;
032 final static char CTRL_OB = 27;
033 final static char DELETE = 127;
034 final static char CTRL_QM = 127;
035
036
037 /**
038 * Logical constants for key operations.
039 */
040
041 /**
042 * Unknown operation.
043 */
044 final short UNKNOWN = -99;
045
046 /**
047 * Operation that moves to the beginning of the buffer.
048 */
049 final short MOVE_TO_BEG = -1;
050
051 /**
052 * Operation that moves to the end of the buffer.
053 */
054 final short MOVE_TO_END = -3;
055
056 /**
057 * Operation that moved to the previous character in the buffer.
058 */
059 final short PREV_CHAR = -4;
060
061 /**
062 * Operation that issues a newline.
063 */
064 final short NEWLINE = -6;
065
066 /**
067 * Operation that deletes the buffer from the current character to the end.
068 */
069 final short KILL_LINE = -7;
070
071 /**
072 * Operation that clears the screen.
073 */
074 final short CLEAR_SCREEN = -8;
075
076 /**
077 * Operation that sets the buffer to the next history item.
078 */
079 final short NEXT_HISTORY = -9;
080
081 /**
082 * Operation that sets the buffer to the previous history item.
083 */
084 final short PREV_HISTORY = -11;
085
086 /**
087 * Operation that redisplays the current buffer.
088 */
089 final short REDISPLAY = -13;
090
091 /**
092 * Operation that deletes the buffer from the cursor to the beginning.
093 */
094 final short KILL_LINE_PREV = -15;
095
096 /**
097 * Operation that deletes the previous word in the buffer.
098 */
099 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 }