Package jline.console

Examples of jline.console.KeyMap.bind()


            historyFile = new FileHistory(new File(System.getProperty("user.home"), ".sqlcmd_history"));
            lineInputReader.setHistory(historyFile);

            // Make Ctrl-D (EOF) exit if on an empty line, otherwise delete the next character.
            KeyMap keyMap = lineInputReader.getKeys();
            keyMap.bind(new Character(KeyMap.CTRL_D).toString(), new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e)
                {
                    CursorBuffer cursorBuffer = lineInputReader.getCursorBuffer();
                    if (cursorBuffer.length() == 0) {
View Full Code Here


        map.bindIfNotBound("\033[0A", Operation.PREVIOUS_HISTORY);
        assertEquals( Operation.PREVIOUS_HISTORY, map.getBound("\033[0A") );


        map.bind( "\033[0AB", Operation.NEXT_HISTORY );
        assertTrue( map.getBound("\033[0A") instanceof KeyMap );
        assertEquals( Operation.NEXT_HISTORY , map.getBound("\033[0AB") );
    }

}
View Full Code Here

    @Test
    public void testHistorySearchBackwardAndForward() throws Exception {
        KeyMap map = console.getKeys();

        // Map in HISTORY_SEARCH_BACKWARD.
        map.bind("\033[0A", HISTORY_SEARCH_BACKWARD);
        map.bind("\033[0B", HISTORY_SEARCH_FORWARD);

        Buffer b = new Buffer().
            append("toes").op(ACCEPT_LINE).
            append("the quick brown").op(ACCEPT_LINE).
View Full Code Here

    public void testHistorySearchBackwardAndForward() throws Exception {
        KeyMap map = console.getKeys();

        // Map in HISTORY_SEARCH_BACKWARD.
        map.bind("\033[0A", HISTORY_SEARCH_BACKWARD);
        map.bind("\033[0B", HISTORY_SEARCH_FORWARD);

        Buffer b = new Buffer().
            append("toes").op(ACCEPT_LINE).
            append("the quick brown").op(ACCEPT_LINE).
            append("fox jumps").op(ACCEPT_LINE).
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.