Skip to content
Kward Search API index

Class: Kward::CLI::RuntimeHelpers::TerminalHandoffInput

Inherits:
Struct
  • Object
show all
Defined in:
lib/kward/cli/runtime_helpers.rb

Overview

Lets the PTY pumps resolve an ambiguous legacy Escape without reading ahead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#on_tab_action ⇒ Object

Returns the value of attribute on_tab_action

Returns:

  • (Object) —

    the current value of on_tab_action



13
14
15
# File 'lib/kward/cli/runtime_helpers.rb', line 13

def on_tab_action
  @on_tab_action
end

#prompt ⇒ Object

Returns the value of attribute prompt

Returns:

  • (Object) —

    the current value of prompt



13
14
15
# File 'lib/kward/cli/runtime_helpers.rb', line 13

def prompt
  @prompt
end

Instance Method Details

#call(chunk) ⇒ Object



14
15
16
17
18
# File 'lib/kward/cli/runtime_helpers.rb', line 14

def call(chunk)
  filtered = prompt.filter_terminal_handoff_input(chunk)
  on_tab_action.call(filtered[:tab_action]) if filtered[:tab_action]
  filtered
end

#flush_pending_escape ⇒ Object



20
21
22
# File 'lib/kward/cli/runtime_helpers.rb', line 20

def flush_pending_escape
  prompt.flush_terminal_handoff_escape if prompt.respond_to?(:flush_terminal_handoff_escape)
end