View Javadoc

1   /**
2    *	jline - Java console input library
3    *	Copyright (c) 2002, 2003, 2004, 2005, Marc Prud'hommeaux <mwp1@cornell.edu>
4    *	All rights reserved.
5    *
6    *	Redistribution and use in source and binary forms, with or
7    *	without modification, are permitted provided that the following
8    *	conditions are met:
9    *
10   *	Redistributions of source code must retain the above copyright
11   *	notice, this list of conditions and the following disclaimer.
12   *
13   *	Redistributions in binary form must reproduce the above copyright
14   *	notice, this list of conditions and the following disclaimer
15   *	in the documentation and/or other materials provided with
16   *	the distribution.
17   *
18   *	Neither the name of JLine nor the names of its contributors
19   *	may be used to endorse or promote products derived from this
20   *	software without specific prior written permission.
21   *
22   *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23   *	"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24   *	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25   *	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26   *	EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
27   *	FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28   *	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29   *	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30   *	DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31   *	AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32   *	LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33   *	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34   *	OF THE POSSIBILITY OF SUCH DAMAGE.
35   */
36  package jline;
37  
38  
39  import java.awt.event.KeyEvent;
40  
41  
42  /**
43   *	Synbolic constants for Console operations and virtual key bindings.
44   *
45   *	@see KeyEvent
46   *  @author  <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
47   */
48  public interface ConsoleOperations
49  {
50  	String CR = System.getProperty ("line.separator");
51  
52  	char BACKSPACE = '\b';
53  	char RESET_LINE = '\r';
54  	char KEYBOARD_BELL = '\07';
55  
56  	char CTRL_P = 16;
57  	char CTRL_N = 14;
58  	char CTRL_B = 2;
59  	char CTRL_F = 6;
60  
61  
62  	/**
63  	 *	Logical constants for key operations.
64  	 */
65  
66  	/**
67  	 *  Unknown operation.
68  	 */
69  	short UNKNOWN				= -99;
70  
71  	/**
72  	 *  Operation that moves to the beginning of the buffer.
73  	 */
74  	short MOVE_TO_BEG			= -1;
75  
76  	/**
77  	 *  Operation that moves to the end of the buffer.
78  	 */
79  	short MOVE_TO_END			= -3;
80  
81  	/**
82  	 *  Operation that moved to the previous character in the buffer.
83  	 */
84  	short PREV_CHAR				= -4;
85  
86  	/**
87  	 *  Operation that issues a newline.
88  	 */
89  	short NEWLINE				= -6;
90  
91  	/**
92  	 *  Operation that deletes the buffer from the current character to the end.
93  	 */
94  	short KILL_LINE				= -7;
95  
96  	/**
97  	 *  Operation that clears the screen.
98  	 */
99  	short CLEAR_SCREEN			= -8;
100 
101 	/**
102 	 *  Operation that sets the buffer to the next history item.
103 	 */
104 	short NEXT_HISTORY			= -9;
105 
106 	/**
107 	 *  Operation that sets the buffer to the previous history item.
108 	 */
109 	short PREV_HISTORY			= -11;
110 
111 	/**
112 	 *  Operation that redisplays the current buffer.
113 	 */
114 	short REDISPLAY				= -13;
115 
116 	/**
117 	 *  Operation that deletes the buffer from the cursor to the beginning.
118 	 */
119 	short KILL_LINE_PREV		= -15;
120 
121 	/**
122 	 *  Operation that deletes the previous word in the buffer.
123 	 */
124 	short DELETE_PREV_WORD		= -16;
125 
126 	/**
127 	 *  Operation that moves to the next character in the buffer.
128 	 */
129 	short NEXT_CHAR				= -19;
130 
131 	/**
132 	 *  Operation that moves to the previous character in the buffer.
133 	 */
134 	short REPEAT_PREV_CHAR		= -20;
135 
136 	/**
137 	 *  Operation that searches backwards in the command history.
138 	 */
139 	short SEARCH_PREV			= -21;
140 
141 	/**
142 	 *  Operation that repeats the character.
143 	 */
144 	short REPEAT_NEXT_CHAR		= -24;
145 
146 	/**
147 	 *  Operation that searches forward in the command history.
148 	 */
149 	short SEARCH_NEXT			= -25;
150 
151 	/**
152 	 *  Operation that moved to the previous whitespace.
153 	 */
154 	short PREV_SPACE_WORD		= -27;
155 
156 	/**
157 	 *  Operation that moved to the end of the current word.
158 	 */
159 	short TO_END_WORD			= -29;
160 
161 	/**
162 	 *  Operation that
163 	 */
164 	short REPEAT_SEARCH_PREV	= -34;
165 
166 	/**
167 	 *  Operation that
168 	 */
169 	short PASTE_PREV			= -36;
170 
171 	/**
172 	 *  Operation that
173 	 */
174 	short REPLACE_MODE			= -37;
175 
176 	/**
177 	 *  Operation that
178 	 */
179 	short SUBSTITUTE_LINE		= -38;
180 
181 	/**
182 	 *  Operation that
183 	 */
184 	short TO_PREV_CHAR			= -39;
185 
186 	/**
187 	 *  Operation that
188 	 */
189 	short NEXT_SPACE_WORD		= -40;
190 
191 	/**
192 	 *  Operation that
193 	 */
194 	short DELETE_PREV_CHAR		= -41;
195 
196 	/**
197 	 *  Operation that
198 	 */
199 	short ADD					= -42;
200 
201 	/**
202 	 *  Operation that
203 	 */
204 	short PREV_WORD				= -43;
205 
206 	/**
207 	 *  Operation that
208 	 */
209 	short CHANGE_META			= -44;
210 
211 	/**
212 	 *  Operation that
213 	 */
214 	short DELETE_META			= -45;
215 
216 	/**
217 	 *  Operation that
218 	 */
219 	short END_WORD				= -46;
220 
221 	/**
222 	 *  Operation that
223 	 */
224 	short INSERT				= -48;
225 
226 	/**
227 	 *  Operation that
228 	 */
229 	short REPEAT_SEARCH_NEXT	= -49;
230 
231 	/**
232 	 *  Operation that
233 	 */
234 	short PASTE_NEXT			= -50;
235 
236 	/**
237 	 *  Operation that
238 	 */
239 	short REPLACE_CHAR			= -51;
240 
241 	/**
242 	 *  Operation that
243 	 */
244 	short SUBSTITUTE_CHAR		= -52;
245 
246 	/**
247 	 *  Operation that
248 	 */
249 	short TO_NEXT_CHAR			= -53;
250 
251 	/**
252 	 *  Operation that undoes the previous operation.
253 	 */
254 	short UNDO					= -54;
255 
256 	/**
257 	 *  Operation that moved to the next word.
258 	 */
259 	short NEXT_WORD				= -55;
260 
261 	/**
262 	 *  Operation that deletes the previous character.
263 	 */
264 	short DELETE_NEXT_CHAR		= -56;
265 
266 	/**
267 	 *  Operation that toggles between uppercase and lowercase.
268 	 */
269 	short CHANGE_CASE			= -57;
270 
271 	/**
272 	 *  Operation that performs completion operation on the current word.
273 	 */
274 	short COMPLETE				= -58;
275 
276 	/**
277 	 *  Operation that exits the command prompt.
278 	 */
279 	short EXIT					= -59;
280 
281 	/**
282 	 *  Operation that pastes the contents of the cliboard into the line
283 	 */
284 	short PASTE				= -60;
285 }
286