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