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