io.termd.core.readline.Keymap.bindFunction()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中io.termd.core.readline.Keymap.bindFunction()方法的一些代码示例,展示了Keymap.bindFunction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keymap.bindFunction()方法的具体详情如下:
包路径:io.termd.core.readline.Keymap
类名称:Keymap
方法名:bindFunction

Keymap.bindFunction介绍

[英]Bind a function to a key sequence, the key seq must be in inputrc format.
[中]将函数绑定到密钥序列,密钥序列必须为inputrc格式。

代码示例

代码示例来源:origin: io.termd/termd-core

/**
 * 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);
}

代码示例来源:origin: termd/termd

/**
 * 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);
}

代码示例来源:origin: termd/termd

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);
}

代码示例来源:origin: io.termd/termd-core

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);
}

代码示例来源:origin: com.alibaba.middleware/termd-core

@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());
 }
}

代码示例来源:origin: io.termd/termd-core

@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());
}

代码示例来源:origin: com.alibaba.middleware/termd-core

@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());
}

代码示例来源:origin: termd/termd

@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());
 }
}

代码示例来源:origin: termd/termd

@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());
}

代码示例来源:origin: io.termd/termd-core

@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());
 }
}

相关文章

微信公众号

最新文章

更多