class Riffer::Rig::Terminal::KeyDecoder
Constants
- CSI_KEYS
- CSI_U_ENTER
- CSI_U_ESCAPE
- CSI_U_LEGACY_KEYS
-
The flagโs exception list keeps Enter, Tab, and Backspace legacy but not the letters sharing their C0 bytes, so Ctrl-J arrives as CSI-u while its legacy byte โ\nโ decodes as :newline. The tableโs second number is the modifier bitfield: 4 = Ctrl, 2 = Alt.
- CSI_U_LETTERS
- CSI_U_TAB
- ESCAPE
- MAX_CHARACTER_BYTES
- META_KEYS
- MODIFIED_CSI_KEYS
- PASTE_END
- PASTE_START
- TILDE_KEYS
Public Class Methods
() → void
Source
# File lib/riffer/rig/terminal/key_decoder.rb, line 49 def initialize @state = :ground @sequence = +'' end
@rbs return: void
Public Instance Methods
() → Array[Riffer::Rig::Terminal::Key]
Source
# File lib/riffer/rig/terminal/key_decoder.rb, line 74 def flush # An idle gap inside a paste must not end it: the rest would decode as # keystrokes, and its newlines would submit. return [] if @state == :paste events = case @state when :escape then [Riffer::Rig::Terminal::Key.new(:escape)] when :character then stray else [] #: Array[Riffer::Rig::Terminal::Key] end @state = :ground @sequence = +'' events end
@rbs return: Array
() → bool
Source
# File lib/riffer/rig/terminal/key_decoder.rb, line 55 def pending? @state != :ground end
@rbs return: bool
(Integer byte) → Array[Riffer::Rig::Terminal::Key]
Source
# File lib/riffer/rig/terminal/key_decoder.rb, line 61 def push(byte) char = byte.chr case @state when :escape then escape(char) when :csi then csi(char) when :ss3 then ss3(char) when :paste then paste(char) when :character then continuation(char) else ground(char) end end
@rbs byte: Integer @rbs return: Array