public static Keymap create() { InputStream inputrc = InputrcParser.class.getResourceAsStream("inputrc"); return new Keymap(inputrc); }
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()); } }
/** * 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) { readline( new Readline(Keymap.getDefault()).addFunctions(Function.loadDefaults()), conn); }
@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()); }
/** * 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) { readline( new Readline(Keymap.getDefault()).addFunctions(Function.loadDefaults()), conn); }
public static Keymap getDefault() { InputStream inputrc = Keymap.class.getResourceAsStream("inputrc"); return new Keymap(inputrc); }
@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()); }
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 Keymap create() { InputStream inputrc = InputrcParser.class.getResourceAsStream("inputrc"); return new Keymap(inputrc); }
@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()); }
public static Keymap getDefault() { InputStream inputrc = Keymap.class.getResourceAsStream("inputrc"); return new Keymap(inputrc); }
@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()); } }
public static Keymap defaultKeymap() { Buffer buffer = Helper.loadResource(TelnetTermOptions.DEFAULT_INPUTRC); return new Keymap(new ByteArrayInputStream(buffer.getBytes())); }
@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()); } }
public void accept(final TtyConnection conn) { InputStream inputrc = Keymap.class.getResourceAsStream("inputrc"); Keymap keymap = new Keymap(inputrc); Readline readline = new Readline(keymap); for (io.termd.core.readline.Function function : Helper.loadServices(Thread.currentThread().getContextClassLoader(), io.termd.core.readline.Function.class)) { readline.addFunction(function); } conn.write("Welcome to Term.d shell example\n\n"); read(conn, readline); }
public void accept(final TtyConnection conn) { InputStream inputrc = Keymap.class.getResourceAsStream("inputrc"); Keymap keymap = new Keymap(inputrc); Readline readline = new Readline(keymap); for (io.termd.core.readline.Function function : Helper.loadServices(Thread.currentThread().getContextClassLoader(), io.termd.core.readline.Function.class)) { readline.addFunction(function); } conn.write("Welcome to Term.d shell example\n\n"); read(conn, readline); }
public TtyBridge readline() { InputStream inputrc = Keymap.class.getResourceAsStream("inputrc"); Keymap keymap = new Keymap(inputrc); Readline readline = new Readline(keymap); for (io.termd.core.readline.Function function : Helper.loadServices(Thread.currentThread().getContextClassLoader(), io.termd.core.readline.Function.class)) { log.trace("Server is adding function to readline: {}", function); readline.addFunction(function); } conn.setTerminalTypeHandler(term -> { // Not used yet but we should propagage this to the process builder // System.out.println("CLIENT $TERM=" + term); }); conn.stdoutHandler().accept(Helper.toCodePoints("Welcome sir\n")); read(conn, readline); return this; }