/** * Bind a function to a key sequence, the key seq must be in <i>inputrc</i> format. * * @param keyseq the key sequence * @param function the function to bind * @return this keymap */ public Keymap bindFunction(String keyseq, String function) { return bindFunction(InputrcParser.parseKeySeq(keyseq), function); }
/** * Bind a function to a key sequence, the key seq must be in <i>inputrc</i> format. * * @param keyseq the key sequence * @param function the function to bind * @return this keymap */ public Keymap bindFunction(String keyseq, String function) { return bindFunction(InputrcParser.parseKeySeq(keyseq), function); }
public static void handle(TtyConnection conn) { // The reverse function simply reverse the edit buffer Function reverseFunction = new ReverseFunction(); ReadlineExample.readline( // Bind reverse to Ctrl-g to the reverse function new Readline(Keymap.getDefault().bindFunction("\\C-g", "reverse")). addFunctions(Function.loadDefaults()).addFunction(reverseFunction), conn); }
public static void handle(TtyConnection conn) { // The reverse function simply reverse the edit buffer Function reverseFunction = new ReverseFunction(); ReadlineExample.readline( // Bind reverse to Ctrl-g to the reverse function new Readline(Keymap.getDefault().bindFunction("\\C-g", "reverse")). addFunctions(Function.loadDefaults()).addFunction(reverseFunction), conn); }
@Test public void bindFunction2() { Keymap keymap = new Keymap(); keymap.bindFunction(new int[]{'J' - 64}, "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); } }
@Test public void bindFunction1() { Keymap keymap = new Keymap(); keymap.bindFunction("\\C-j", "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); }
@Test public void bindFunction1() { Keymap keymap = new Keymap(); keymap.bindFunction("\\C-j", "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); }
@Test public void bindFunction2() { Keymap keymap = new Keymap(); keymap.bindFunction(new int[]{'J' - 64}, "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); } }
@Test public void bindFunction1() { Keymap keymap = new Keymap(); keymap.bindFunction("\\C-j", "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); }
@Test public void bindFunction2() { Keymap keymap = new Keymap(); keymap.bindFunction(new int[]{'J' - 64}, "my-func"); EventQueue eq = new EventQueue(keymap); eq.append('J' - 64); assertEquals("my-func", ((FunctionEvent) eq.next()).name()); assertFalse(eq.hasNext()); } }