Package org.jline.keymap
Class BindingReader
java.lang.Object
org.jline.keymap.BindingReader
The BindingReader will transform incoming chars into
key bindings
- Author:
- Guillaume Nodet
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected final StringBuilder
protected final org.jline.utils.NonBlockingReader
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
peekCharacter
(long timeout) <T> T
readBinding
(KeyMap<T> keys) Read from the input stream and decode an operation from the key map.<T> T
readBinding
(KeyMap<T> keys, KeyMap<T> local) <T> T
readBinding
(KeyMap<T> keys, KeyMap<T> local, boolean block) int
Read a codepoint from the terminal.int
readStringUntil
(String sequence) void
-
Field Details
-
reader
protected final org.jline.utils.NonBlockingReader reader -
opBuffer
-
pushBackChar
-
lastBinding
-
-
Constructor Details
-
BindingReader
public BindingReader(org.jline.utils.NonBlockingReader reader)
-
-
Method Details
-
readBinding
Read from the input stream and decode an operation from the key map. The input stream will be read character by character until a matching binding can be found. Characters that can't possibly be matched to any binding will be send with theKeyMap.getNomatch()
binding. Unicode (>= 128) characters will be matched toKeyMap.getUnicode()
. If the current key sequence is ambiguous, i.e. the sequence is bound but it's also a prefix to other sequences, then theKeyMap.getAmbiguousTimeout()
timeout will be used to wait for another incoming character. If a character comes, the disambiguation will be done. If the timeout elapses and no character came in, or if the timeout is <= 0, the current bound operation will be returned.- Type Parameters:
T
- the type of bindings to be read- Parameters:
keys
- the KeyMap to use for decoding the input stream- Returns:
- the decoded binding or
null
if the end of stream has been reached
-
readBinding
-
readBinding
-
readStringUntil
-
readCharacter
public int readCharacter()Read a codepoint from the terminal.- Returns:
- the character, or -1 if an EOF is received.
-
readCharacterBuffered
public int readCharacterBuffered() -
peekCharacter
public int peekCharacter(long timeout) -
runMacro
-
getCurrentBuffer
-
getLastBinding
-