class
TermBuf::ResponseScanner
- TermBuf::ResponseScanner
- Reference
- Object
Overview
Splits a stream of bytes arriving from the terminal into complete escape sequences and everything else.
The prober needs this to tell a reply to its own query from a keystroke that happened to arrive at the same moment, and the input decoder needs the same split for the same reason. Bytes that do not form a complete sequence yet are held back rather than guessed at.
Defined in:
termbuf/caps/response_scanner.crConstant Summary
-
BEL =
7_u8 -
ESC =
27_u8 -
MAX_SEQUENCE =
1024 -
A sequence longer than this is treated as a stray escape followed by ordinary input. Without a bound, one
ESCwith nothing after it would hold every later byte hostage.
Constructors
Instance Method Summary
-
#clear : Nil
Discards anything held back.
-
#feed(chunk : Bytes, & : Kind, Bytes -> ) : Nil
Feeds bytes in, yielding each complete chunk that can be classified.
-
#flush(& : Kind, Bytes -> ) : Nil
Treats whatever is held back as ordinary text, which is what a timeout means: no more of that sequence is coming.
-
#pending : Bytes
Bytes held back because they do not yet form a complete sequence.
-
#pending? : Bool
Whether anything is being held back, without copying it out.
Constructor Detail
Instance Method Detail
Feeds bytes in, yielding each complete chunk that can be classified.
Treats whatever is held back as ordinary text, which is what a timeout means: no more of that sequence is coming.