    001    /**
    002     *      jline - Java console input library
    003     *      Copyright (c) 2002, 2003, 2004, 2005, Marc Prud'hommeaux <mwp1@cornell.edu>
    004     *      All rights reserved.
    005     *
    006     *      Redistribution and use in source and binary forms, with or
    007     *      without modification, are permitted provided that the following
    008     *      conditions are met:
    009     *
    010     *      Redistributions of source code must retain the above copyright
    011     *      notice, this list of conditions and the following disclaimer.
    012     *
    013     *      Redistributions in binary form must reproduce the above copyright
    014     *      notice, this list of conditions and the following disclaimer
    015     *      in the documentation and/or other materials provided with
    016     *      the distribution.
    017     *
    018     *      Neither the name of JLine nor the names of its contributors
    019     *      may be used to endorse or promote products derived from this
    020     *      software without specific prior written permission.
    021     *
    022     *      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    023     *      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
    024     *      BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    025     *      AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
    026     *      EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
    027     *      FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    028     *      OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    029     *      PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    030     *      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    031     *      AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    032     *      LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    033     *      IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    034     *      OF THE POSSIBILITY OF SUCH DAMAGE.
    035     */
    036    package jline;
    037
    038
    039    import java.awt.event.KeyEvent;
    040
    041
    042    /**
    043     *      Synbolic constants for Console operations and virtual key bindings.
    044     *
    045     *      @see KeyEvent
    046     *  @author  <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
    047     */
    048    public interface ConsoleOperations
    049    {
    050            String CR = System.getProperty ("line.separator");
    051
    052            char BACKSPACE = '\b';
    053            char RESET_LINE = '\r';
    054            char KEYBOARD_BELL = '\07';
    055
    056            char CTRL_P = 16;
    057            char CTRL_N = 14;
    058            char CTRL_B = 2;
    059            char CTRL_F = 6;
    060
    061
    062            /**
    063             *      Logical constants for key operations.
    064             */
    065
    066            /**
    067             *  Unknown operation.
    068             */
    069            short UNKNOWN                           = -99;
    070
    071            /**
    072             *  Operation that moves to the beginning of the buffer.
    073             */
    074            short MOVE_TO_BEG                       = -1;
    075
    076            /**
    077             *  Operation that moves to the end of the buffer.
    078             */
    079            short MOVE_TO_END                       = -3;
    080
    081            /**
    082             *  Operation that moved to the previous character in the buffer.
    083             */
    084            short PREV_CHAR                         = -4;
    085
    086            /**
    087             *  Operation that issues a newline.
    088             */
    089            short NEWLINE                           = -6;
    090
    091            /**
    092             *  Operation that deletes the buffer from the current character to the end.
    093             */
    094            short KILL_LINE                         = -7;
    095
    096            /**
    097             *  Operation that clears the screen.
    098             */
    099            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