1 /* 2 * Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved. 3 * 4 * This software is distributable under the BSD license. See the terms of the 5 * BSD license in the documentation provided with this software. 6 */ 7 package jline; 8 9 import java.awt.event.KeyEvent; 10 11 /** 12 * Symbolic constants for Console operations and virtual key bindings. 13 * @see KeyEvent 14 * 15 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> 16 */ 17 public interface ConsoleOperations { 18 final String CR = System.getProperty("line.separator"); 19 final char BACKSPACE = '\b'; 20 final char RESET_LINE = '\r'; 21 final char KEYBOARD_BELL = '\07'; 22 final char CTRL_A = 1; 23 final char CTRL_B = 2; 24 final char CTRL_C = 3; 25 final char CTRL_D = 4; 26 final char CTRL_E = 5; 27 final char CTRL_F = 6; 28 final char CTRL_G = 7; 29 final static char CTRL_K = 11; 30 final static char CTRL_L = 12; 31 final char CTRL_N = 14; 32 final char CTRL_P = 16; 33 final static char CTRL_OB = 27; 34 final static char DELETE = 127; 35 final static char CTRL_QM = 127; 36 37 38 /** 39 * Logical constants for key operations. 40 */ 41 42 /** 43 * Unknown operation. 44 */ 45 final short UNKNOWN = -99; 46 47 /** 48 * Operation that moves to the beginning of the buffer. 49 */ 50 final short MOVE_TO_BEG = -1; 51 52 /** 53 * Operation that moves to the end of the buffer. 54 */ 55 final short MOVE_TO_END = -3; 56 57 /** 58 * Operation that moved to the previous character in the buffer. 59 */ 60 final short PREV_CHAR = -4; 61 62 /** 63 * Operation that issues a newline. 64 */ 65 final short NEWLINE = -6; 66 67 /** 68 * Operation that deletes the buffer from the current character to the end. 69 */ 70 final short KILL_LINE = -7; 71 72 /** 73 * Operation that clears the screen. 74 */ 75 final short CLEAR_SCREEN = -8; 76 77 /** 78 * Operation that sets the buffer to the next history item. 79 */ 80 final short NEXT_HISTORY = -9; 81 82 /** 83 * Operation that sets the buffer to the previous history item. 84 */ 85 final short PREV_HISTORY = -11; 86 87 /** 88 * Operation that redisplays the current buffer. 89 */ 90 final short REDISPLAY = -13; 91 92 /** 93 * Operation that deletes the buffer from the cursor to the beginning. 94 */ 95 final short KILL_LINE_PREV = -15; 96 97 /** 98 * Operation that deletes the previous word in the buffer. 99 */ 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 } 283