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

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

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

KeyEvent.length介绍

暂无

代码示例

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

public KeyEvent next() {
 if (events.isEmpty()) {
  KeyEvent next = match(pending);
  if (next != null) {
   events.add(next);
   pending = Arrays.copyOfRange(pending, next.length(), pending.length);
  }
 }
 return events.removeFirst();
}

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

public KeyEvent next() {
 if (events.isEmpty()) {
  KeyEvent next = match(pending);
  if (next != null) {
   events.add(next);
   pending = Arrays.copyOfRange(pending, next.length(), pending.length);
  }
 }
 return events.removeFirst();
}

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

default IntBuffer buffer() {
 int length = length();
 IntBuffer buf = IntBuffer.allocate(length);
 for (int i = 0;i < length;i++) {
  buf.put(getCodePointAt(i));
 }
 buf.flip();
 return buf;
}

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

default IntBuffer buffer() {
 int length = length();
 IntBuffer buf = IntBuffer.allocate(length);
 for (int i = 0;i < length;i++) {
  buf.put(getCodePointAt(i));
 }
 buf.flip();
 return buf;
}

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

private void handle(KeyEvent event) {
 if (event.length() == 1) {
  if (event.getCodePointAt(0) == 4 && buffer.getSize() == 0) {
  for (int i = 0;i < event.length();i++) {
   int codePoint = event.getCodePointAt(i);
   try {

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

@Test
public void testDecodeKeySeqPrefix() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('c').hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
 assertTrue(queue.hasNext());
 key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testDecodeKeySeqPrefix() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('c').hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
 assertTrue(queue.hasNext());
 key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testDecodeKeySeqPrefix() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('c').hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
 assertTrue(queue.hasNext());
 key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testDecodeKeySeq() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('b', 'c').hasNext());
 FunctionEvent action = (FunctionEvent) queue.next();
 assertEquals("foo", action.name());
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testDecodeKeySeq() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('b', 'c').hasNext());
 FunctionEvent action = (FunctionEvent) queue.next();
 assertEquals("foo", action.name());
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testDecodeKeySeq() {
 EventQueue queue = new EventQueue(new Keymap(new ByteArrayInputStream("\"ab\":foo".getBytes())));
 assertFalse(queue.append('a').hasNext());
 assertTrue(queue.append('b', 'c').hasNext());
 FunctionEvent action = (FunctionEvent) queue.next();
 assertEquals("foo", action.name());
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('c', key.getCodePointAt(0));
 assertFalse(queue.hasNext());
}

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

@Test
public void testNotRecognizePredefinedKey() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append('a');
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
}

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

@Test
public void testNotRecognizePredefinedKey() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append('a');
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
}

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

@Test
public void testNotRecognizePredefinedKey() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append('a');
 assertTrue(queue.hasNext());
 KeyEvent key = (KeyEvent) queue.next();
 assertEquals(1, key.length());
 assertEquals('a', key.getCodePointAt(0));
}

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

@Test
public void testRecognizePredefinedKey1() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertTrue(queue.hasNext());
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent) queue.peek()).getCodePointAt(0));
 queue.append(65);
 assertTrue(queue.hasNext());
 assertEquals(Keys.UP, queue.next());
}

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

@Test
public void testRecognizePredefinedKey2() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent)queue.peek()).getCodePointAt(0));
 assertTrue(queue.hasNext());
 queue.append(66);
 assertTrue(queue.hasNext());
 assertEquals(Keys.DOWN, queue.next());
}

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

@Test
public void testRecognizePredefinedKey1() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertTrue(queue.hasNext());
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent) queue.peek()).getCodePointAt(0));
 queue.append(65);
 assertTrue(queue.hasNext());
 assertEquals(Keys.UP, queue.next());
}

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

@Test
public void testRecognizePredefinedKey1() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertTrue(queue.hasNext());
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent) queue.peek()).getCodePointAt(0));
 queue.append(65);
 assertTrue(queue.hasNext());
 assertEquals(Keys.UP, queue.next());
}

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

@Test
public void testRecognizePredefinedKey2() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent)queue.peek()).getCodePointAt(0));
 assertTrue(queue.hasNext());
 queue.append(66);
 assertTrue(queue.hasNext());
 assertEquals(Keys.DOWN, queue.next());
}

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

@Test
public void testRecognizePredefinedKey2() {
 EventQueue queue = new EventQueue(new Keymap());
 queue.append(27, 91);
 assertEquals(1, ((KeyEvent) queue.peek()).length());
 assertEquals(27, ((KeyEvent)queue.peek()).getCodePointAt(0));
 assertTrue(queue.hasNext());
 queue.append(66);
 assertTrue(queue.hasNext());
 assertEquals(Keys.DOWN, queue.next());
}

相关文章