001 /**
002 * jline - Java console input library
003 * Copyright (c) 2002-2006, Marc Prud'hommeaux <mwp1@cornell.edu>
004 * All rights reserved.
005 *
006 * Redistribution and use in source and binary forms, with or
007 * without modification, are permitted provided that the following
008 * conditions are met:
009 *
010 * Redistributions of source code must retain the above copyright
011 * notice, this list of conditions and the following disclaimer.
012 *
013 * Redistributions in binary form must reproduce the above copyright
014 * notice, this list of conditions and the following disclaimer
015 * in the documentation and/or other materials provided with
016 * the distribution.
017 *
018 * Neither the name of JLine nor the names of its contributors
019 * may be used to endorse or promote products derived from this
020 * software without specific prior written permission.
021 *
022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
025 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
026 * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
027 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
028 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
029 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
031 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
033 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
034 * OF THE POSSIBILITY OF SUCH DAMAGE.
035 */
036 package jline;
037
038
039 import java.awt.event.KeyEvent;
040
041
042 /**
043 * Synbolic constants for Console operations and virtual key bindings.
044 *
045 * @see KeyEvent
046 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
047 */
048 public interface ConsoleOperations
049 {
050 final String CR = System.getProperty ("line.separator");
051
052 final char BACKSPACE = '\b';
053 final char RESET_LINE = '\r';
054 final char KEYBOARD_BELL = '\07';
055
056 final char CTRL_A = 1;
057 final char CTRL_B = 2;
058 final char CTRL_C = 3;
059 final char CTRL_D = 4;
060 final char CTRL_E = 5;
061 final char CTRL_F = 6;
062 final char CTRL_N = 14;
063 final char CTRL_P = 16;
064
065
066 /**
067 * Logical constants for key operations.
068 */
069
070 /**
071 * Unknown operation.
072 */
073 final short UNKNOWN = -99;
074
075 /**
076 * Operation that moves to the beginning of the buffer.
077 */
078 final short MOVE_TO_BEG = -1;
079
080 /**
081 * Operation that moves to the end of the buffer.
082 */
083 final short MOVE_TO_END = -3;
084
085 /**
086 * Operation that moved to the previous character in the buffer.
087 */
088 final short PREV_CHAR = -4;
089
090 /**
091 * Operation that issues a newline.
092 */
093 final short NEWLINE = -6;
094
095 /**
096 * Operation that deletes the buffer from the current character to the end.
097 */
098 final short KILL_LINE = -7;
099
100 /**
101 * Operation that clears the screen.
102 */
103 final short CLEAR_SCREEN = -8;
104
105 /**
106 * Operation that sets the buffer to the next history item.
107 */
108 final short NEXT_HISTORY = -9;
109
110 /**
111 * Operation that sets the buffer to the previous history item.
112 */
113 final short PREV_HISTORY = -11;
114
115 /**
116 * Operation that redisplays the current buffer.
117 */
118 final short REDISPLAY = -13;
119
120 /**
121 * Operation that deletes the buffer from the cursor to the beginning.
122 */
123 final short KILL_LINE_PREV = -15;
124
125 /**
126 * Operation that deletes the previous word in the buffer.
127 */
128 final short DELETE_PREV_WORD = -16;
129
130 /**
131 * Operation that moves to the next character in the buffer.
132 */
133 final short NEXT_CHAR = -19;
134
135 /**
136 * Operation that moves to the previous character in the buffer.
137 */
138 final short REPEAT_PREV_CHAR = -20;
139
140 /**
141 * Operation that searches backwards in the command history.
142 */
143 final short SEARCH_PREV = -21;
144
145 /**
146 * Operation that repeats the character.
147 */
148 final short REPEAT_NEXT_CHAR = -24;
149
150 /**
151 * Operation that searches forward in the command history.
152 */
153 final short SEARCH_NEXT = -25;
154
155 /**
156 * Operation that moved to the previous whitespace.
157 */
158 final short PREV_SPACE_WORD = -27;
159
160 /**
161 * Operation that moved to the end of the current word.
162 */
163 final short TO_END_WORD = -29;
164
165 /**
166 * Operation that
167 */
168 final short REPEAT_SEARCH_PREV = -34;
169
170 /**
171 * Operation that
172 */
173 final short PASTE_PREV = -36;
174
175 /**
176 * Operation that
177 */
178 final short REPLACE_MODE = -37;
179
180 /**
181 * Operation that
182 */
183 final short SUBSTITUTE_LINE = -38;
184
185 /**
186 * Operation that
187 */
188 final short TO_PREV_CHAR = -39;
189
190 /**
191 * Operation that
192 */
193 final short NEXT_SPACE_WORD = -40;
194
195 /**
196 * Operation that
197 */
198 final short DELETE_PREV_CHAR = -41;
199
200 /**
201 * Operation that
202 */
203 final short ADD = -42;
204
205 /**
206 * Operation that
207 */
208 final short PREV_WORD = -43;
209
210 /**
211 * Operation that
212 */
213 final short CHANGE_META = -44;
214
215 /**
216 * Operation that
217 */
218 final short DELETE_META = -45;
219
220 /**
221 * Operation that
222 */
223 final short END_WORD = -46;
224
225 /**
226 * Operation that
227 */
228 final short INSERT = -48;
229
230 /**
231 * Operation that
232 */
233 final short REPEAT_SEARCH_NEXT = -49;
234
235 /**
236 * Operation that
237 */
238 final short PASTE_NEXT = -50;
239
240 /**
241 * Operation that
242 */
243 final short REPLACE_CHAR = -51;
244
245 /**
246 * Operation that
247 */
248 final short SUBSTITUTE_CHAR = -52;
249
250 /**
251 * Operation that
252 */
253 final short TO_NEXT_CHAR = -53;
254
255 /**
256 * Operation that undoes the previous operation.
257 */
258 final short UNDO = -54;
259
260 /**
261 * Operation that moved to the next word.
262 */
263 final short NEXT_WORD = -55;
264
265 /**
266 * Operation that deletes the previous character.
267 */
268 final short DELETE_NEXT_CHAR = -56;
269
270 /**
271 * Operation that toggles between uppercase and lowercase.
272 */
273 final short CHANGE_CASE = -57;
274
275 /**
276 * Operation that performs completion operation on the current word.
277 */
278 final short COMPLETE = -58;
279
280 /**
281 * Operation that exits the command prompt.
282 */
283 final short EXIT = -59;
284
285 /**
286 * Operation that pastes the contents of the cliboard into the line
287 */
288 final short PASTE = -60;
289 }
290