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 */
007package jline;
008
009import 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 */
017public 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 char CTRL_G = 7;
029    final static char CTRL_K = 11;
030    final static char CTRL_L = 12;
031    final char CTRL_N = 14;
032    final char CTRL_P = 16;
033    final static char CTRL_OB = 27;
034    final static char DELETE = 127;
035    final static char CTRL_QM = 127;
036
037
038    /**
039     *        Logical constants for key operations.
040     */
041
042    /**
043     *  Unknown operation.
044     */
045    final short UNKNOWN = -99;
046
047    /**
048     *  Operation that moves to the beginning of the buffer.
049     */
050    final short MOVE_TO_BEG = -1;
051
052    /**
053     *  Operation that moves to the end of the buffer.
054     */
055    final short MOVE_TO_END = -3;
056
057    /**
058     *  Operation that moved to the previous character in the buffer.
059     */
060    final short PREV_CHAR = -4;
061
062    /**
063     *  Operation that issues a newline.
064     */
065    final short NEWLINE = -6;
066
067    /**
068     *  Operation that deletes the buffer from the current character to the end.
069     */
070    final short KILL_LINE = -7;
071
072    /**
073     *  Operation that clears the screen.
074     */
075    final short CLEAR_SCREEN = -8;
076
077    /**
078     *  Operation that sets the buffer to the next history item.
079     */
080    final short NEXT_HISTORY = -9;
081
082    /**
083     *  Operation that sets the buffer to the previous history item.
084     */
085    final short PREV_HISTORY = -11;
086
087    /**
088     *  Operation that redisplays the current buffer.
089     */
090    final short REDISPLAY = -13;
091
092    /**
093     *  Operation that deletes the buffer from the cursor to the beginning.
094     */
095    final short KILL_LINE_PREV = -15;
096
097    /**
098     *  Operation that deletes the previous word in the buffer.
099     */
100    final short DELETE_PREV_WORD = -16;
101
102    /**
103     *  Operation that moves to the next character in the buffer.
104     */
105    final short NEXT_CHAR = -19;
106
107    /**
108     *  Operation that moves to the previous character in the buffer.
109     */
110    final short REPEAT_PREV_CHAR = -20;
111
112    /**
113     *  Operation that searches backwards in the command history.
114     */
115    final short SEARCH_PREV = -21;
116
117    /**
118     *  Operation that repeats the character.
119     */
120    final short REPEAT_NEXT_CHAR = -24;
121
122    /**
123     *  Operation that searches forward in the command history.
124     */
125    final short SEARCH_NEXT = -25;
126
127    /**
128     *  Operation that moved to the previous whitespace.
129     */
130    final short PREV_SPACE_WORD = -27;
131
132    /**
133     *  Operation that moved to the end of the current word.
134     */
135    final short TO_END_WORD = -29;
136
137    /**
138     *  Operation that
139     */
140    final short REPEAT_SEARCH_PREV = -34;
141
142    /**
143     *  Operation that
144     */
145    final short PASTE_PREV = -36;
146
147    /**
148     *  Operation that
149     */
150    final short REPLACE_MODE = -37;
151
152    /**
153     *  Operation that
154     */
155    final short SUBSTITUTE_LINE = -38;
156
157    /**
158     *  Operation that
159     */
160    final short TO_PREV_CHAR = -39;
161
162    /**
163     *  Operation that
164     */
165    final short NEXT_SPACE_WORD = -40;
166
167    /**
168     *  Operation that
169     */
170    final short DELETE_PREV_CHAR = -41;
171
172    /**
173     *  Operation that
174     */
175    final short ADD = -42;
176
177    /**
178     *  Operation that
179     */
180    final short PREV_WORD = -43;
181
182    /**
183     *  Operation that
184     */
185    final short CHANGE_META = -44;
186
187    /**
188     *  Operation that
189     */
190    final short DELETE_META = -45;
191
192    /**
193     *  Operation that
194     */
195    final short END_WORD = -46;
196
197    /**
198     *  Operation that toggles insert/overtype
199     */
200    final short INSERT = -48;
201
202    /**
203     *  Operation that
204     */
205    final short REPEAT_SEARCH_NEXT = -49;
206
207    /**
208     *  Operation that
209     */
210    final short PASTE_NEXT = -50;
211
212    /**
213     *  Operation that
214     */
215    final short REPLACE_CHAR = -51;
216
217    /**
218     *  Operation that
219     */
220    final short SUBSTITUTE_CHAR = -52;
221
222    /**
223     *  Operation that
224     */
225    final short TO_NEXT_CHAR = -53;
226
227    /**
228     *  Operation that undoes the previous operation.
229     */
230    final short UNDO = -54;
231
232    /**
233     *  Operation that moved to the next word.
234     */
235    final short NEXT_WORD = -55;
236
237    /**
238     *  Operation that deletes the previous character.
239     */
240    final short DELETE_NEXT_CHAR = -56;
241
242    /**
243     *  Operation that toggles between uppercase and lowercase.
244     */
245    final short CHANGE_CASE = -57;
246
247    /**
248     *  Operation that performs completion operation on the current word.
249     */
250    final short COMPLETE = -58;
251
252    /**
253     *  Operation that exits the command prompt.
254     */
255    final short EXIT = -59;
256
257    /**
258     *  Operation that pastes the contents of the clipboard into the line
259     */
260    final short PASTE = -60;
261
262    /**
263     * Operation that moves the current History to the beginning.
264     */
265    final static short START_OF_HISTORY = -61;
266
267    /**
268     * Operation that moves the current History to the end.
269     */
270    final static short END_OF_HISTORY = -62;
271
272    /**
273     * Operation that clears whatever text is on the current line.
274     */
275    final static short CLEAR_LINE = -63;
276
277    /**
278     * Operation that aborts the current command (like searching)
279     */
280    final static short ABORT = -64;
281
282}