class Reline::Core

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/reline.rbs

class Reline::Core
  def encoding: () -> Encoding
  def io_gate: () -> Class
  def read_io: (Integer keyseq_timeout, ) -> nil
end

def add_dialog_proc(name_sym, p, context = nil)

def add_dialog_proc(name_sym, p, context = nil)
  raise ArgumentError unless name_sym.instance_of?(Symbol)
  if p.nil?
    @dialog_proc_list.delete(name_sym)
  else
    raise ArgumentError unless p.respond_to?(:call)
    @dialog_proc_list[name_sym] = DialogProc.new(p, context)
  end
end

def ambiguous_width

def ambiguous_width
  may_req_ambiguous_char_width unless defined? @ambiguous_width
  @ambiguous_width
end

def auto_indent_proc=(p)

def auto_indent_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @auto_indent_proc = p
end

def basic_quote_characters=(v)

def basic_quote_characters=(v)
  @basic_quote_characters = v.encode(encoding)
end

def basic_word_break_characters=(v)

def basic_word_break_characters=(v)
  @basic_word_break_characters = v.encode(encoding)
end

def completer_quote_characters=(v)

def completer_quote_characters=(v)
  @completer_quote_characters = v.encode(encoding)
end

def completer_word_break_characters=(v)

def completer_word_break_characters=(v)
  @completer_word_break_characters = v.encode(encoding)
end

def completion_append_character=(val)

def completion_append_character=(val)
  if val.nil?
    @completion_append_character = nil
  elsif val.size == 1
    @completion_append_character = val.encode(encoding)
  elsif val.size > 1
    @completion_append_character = val[0].encode(encoding)
  else
    @completion_append_character = nil
  end
end

def completion_case_fold

def completion_case_fold
  @config.completion_ignore_case
end

def completion_case_fold=(v)

def completion_case_fold=(v)
  @config.completion_ignore_case = v
end

def completion_proc=(p)

def completion_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @completion_proc = p
end

def completion_quote_character

def completion_quote_character
  @completion_quote_character
end

def dialog_proc(name_sym)

def dialog_proc(name_sym)
  @dialog_proc_list[name_sym]
end

def dig_perfect_match_proc=(p)

def dig_perfect_match_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @dig_perfect_match_proc = p
end

def emacs_editing_mode

def emacs_editing_mode
  config.editing_mode = :emacs
  nil
end

def emacs_editing_mode?

def emacs_editing_mode?
  config.editing_mode_is?(:emacs)
end

def encoding

Experimental RBS support (using type sampling data from the type_fusion project).

def encoding: () -> Encoding

This signature was generated using 12 samples from 1 application.

def encoding
  io_gate.encoding
end

def filename_quote_characters=(v)

def filename_quote_characters=(v)
  @filename_quote_characters = v.encode(encoding)
end

def get_screen_size

def get_screen_size
  io_gate.get_screen_size
end

def initialize

def initialize
  self.output = STDOUT
  @dialog_proc_list = {}
  yield self
  @completion_quote_character = nil
  @bracketed_paste_finished = false
end

def inner_readline(prompt, add_hist, multiline, &confirm_multiline_termination)

def inner_readline(prompt, add_hist, multiline, &confirm_multiline_termination)
['RELINE_STDERR_TTY']
o_gate.win?
tderr = File.open(ENV['RELINE_STDERR_TTY'], 'a')

tderr.reopen(ENV['RELINE_STDERR_TTY'], 'w')
err.sync = true
err.puts "Reline is used by #{Process.pid}"
 io_gate.prep
q_ambiguous_char_width
ditor.reset(prompt, encoding: encoding)
tiline
_editor.multiline_on
lock_given?
ne_editor.confirm_multiline_termination_proc = confirm_multiline_termination
_editor.multiline_off
ditor.output = output
ditor.completion_proc = completion_proc
ditor.completion_append_character = completion_append_character
ditor.output_modifier_proc = output_modifier_proc
ditor.prompt_proc = prompt_proc
ditor.auto_indent_proc = auto_indent_proc
ditor.dig_perfect_match_proc = dig_perfect_match_proc
ditor.pre_input_hook = pre_input_hook
g_proc_list.each_pair do |name_sym, d|
_editor.add_dialog_proc(name_sym, d.dialog_proc, d.context)
 config.test_mode
ig.read
ig.reset_default_key_bindings
ate.set_default_key_bindings(config)
ditor.rerender
_editor.set_signal_handlers
_pasting_state = false
 do
ev_pasting_state = io_gate.in_pasting?
ad_io(config.keyseq_timeout) { |inputs|
line_editor.set_pasting_state(io_gate.in_pasting?)
inputs.each { |c|
  line_editor.input_key(c)
  line_editor.rerender
}
if @bracketed_paste_finished
  line_editor.rerender_all
  @bracketed_paste_finished = false
end
 prev_pasting_state == true and not io_gate.in_pasting? and not line_editor.finished?
line_editor.set_pasting_state(false)
prev_pasting_state = false
line_editor.rerender_all
d
eak if line_editor.finished?
ate.move_cursor_column(0)
 Errno::EIO
ybe the I/O has been closed.
 StandardError => e
_editor.finalize
ate.deprep(otio)
e e
 Exception
cluding Interrupt
_editor.finalize
ate.deprep(otio)
e
ditor.finalize
e.deprep(otio)

def input=(val)

def input=(val)
  raise TypeError unless val.respond_to?(:getc) or val.nil?
  if val.respond_to?(:getc) && io_gate.respond_to?(:input=)
    io_gate.input = val
  end
end

def io_gate

Experimental RBS support (using type sampling data from the type_fusion project).

def io_gate: () -> Class

This signature was generated using 11 samples from 1 application.

def io_gate
  Reline::IOGate
end

def may_req_ambiguous_char_width

def may_req_ambiguous_char_width
uous_width = 2 if io_gate == Reline::GeneralIO or !STDOUT.tty?
 if defined? @ambiguous_width
e.move_cursor_column(0)
ut.write "\u{25bd}"
 Encoding::UndefinedConversionError
NG=C
iguous_width = 1
iguous_width = io_gate.cursor_pos.x
e.move_cursor_column(0)
e.erase_after_cursor

def output=(val)

def output=(val)
  raise TypeError unless val.respond_to?(:write) or val.nil?
  @output = val
  if io_gate.respond_to?(:output=)
    io_gate.output = val
  end
end

def output_modifier_proc=(p)

def output_modifier_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @output_modifier_proc = p
end

def pre_input_hook=(p)

def pre_input_hook=(p)
  @pre_input_hook = p
end

def prompt_proc=(p)

def prompt_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @prompt_proc = p
end

def read_2nd_character_of_key_sequence(keyseq_timeout, buffer, c, block)

def read_2nd_character_of_key_sequence(keyseq_timeout, buffer, c, block)
_c = nil
out.timeout(keyseq_timeout / 1000.0) {
cc_c = io_gate.getc
 Timeout::Error # cancel matching only when first byte
k.([Reline::Key.new(c, c, false)])
rn :break
 key_stroke.match_status(buffer.dup.push(succ_c))
 :unmatched
 c == "\e".ord
block.([Reline::Key.new(succ_c, succ_c | 0b10000000, true)])
se
block.([Reline::Key.new(c, c, false), Reline::Key.new(succ_c, succ_c, false)])
d
turn :break
 :matching
_gate.ungetc(succ_c)
turn :next
 :matched
ffer << succ_c
panded = key_stroke.expand(buffer).map{ |expanded_c|
Reline::Key.new(expanded_c, expanded_c, false)
ock.(expanded)
turn :break

def read_escaped_key(keyseq_timeout, c, block)

def read_escaped_key(keyseq_timeout, c, block)
ped_c = nil
out.timeout(keyseq_timeout / 1000.0) {
caped_c = io_gate.getc
 Timeout::Error # independent ESC
k.([Reline::Key.new(c, c, false)])
scaped_c.nil?
ock.([Reline::Key.new(c, c, false)])
f escaped_c >= 128 # maybe, first byte of multi byte
ock.([Reline::Key.new(c, c, false), Reline::Key.new(escaped_c, escaped_c, false)])
f escaped_c == "\e".ord # escape twice
ock.([Reline::Key.new(c, c, false), Reline::Key.new(c, c, false)])

ock.([Reline::Key.new(escaped_c, escaped_c | 0b10000000, true)])

def read_io(keyseq_timeout, &block)

Experimental RBS support (using type sampling data from the type_fusion project).

def read_io: (Integer keyseq_timeout, ) -> nil

This signature was generated using 1 sample from 1 application.

milli-seconds but wait forever after 3rd characters.
GNU Readline will wait for the 2nd character with "keyseq-timeout"

multibyte characters with the 8th bit turned on.
meta-property of meta-key, so that it can be distinguished from
comes before timed out, it is treated as a modifier key with the
ESC if the second character does not arrive. If the second character
is followed by a character, and times out and treats it as a standalone
GNU Readline waits for "keyseq-timeout" milliseconds to see if the ESC
def read_io(keyseq_timeout, &block)
 = []
o
io_gate.getc
 == -1
sult = :unmatched
racketed_paste_finished = true

ffer << c
sult = key_stroke.match_status(buffer)
 result
 :matched
panded = key_stroke.expand(buffer).map{ |expanded_c|
Reline::Key.new(expanded_c, expanded_c, false)
ock.(expanded)
eak
 :matching
 buffer.size == 1
case read_2nd_character_of_key_sequence(keyseq_timeout, buffer, c, block)
when :break then break
when :next  then next
end
d
 :unmatched
 buffer.size == 1 and c == "\e".ord
read_escaped_key(keyseq_timeout, c, block)
se
expanded = buffer.map{ |expanded_c|
  Reline::Key.new(expanded_c, expanded_c, false)
}
block.(expanded)
d
eak

def readline(prompt = '', add_hist = false)

def readline(prompt = '', add_hist = false)
  Reline.update_iogate
  inner_readline(prompt, add_hist, false)
  line = line_editor.line.dup
  line.taint if RUBY_VERSION < '2.7'
  if add_hist and line and line.chomp("\n").size > 0
    Reline::HISTORY << line.chomp("\n")
  end
  line_editor.reset_line if line_editor.line.nil?
  line
end

def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)

def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
  Reline.update_iogate
  io_gate.with_raw_input do
    unless confirm_multiline_termination
      raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
    end
    inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
    whole_buffer = line_editor.whole_buffer.dup
    whole_buffer.taint if RUBY_VERSION < '2.7'
    if add_hist and whole_buffer and whole_buffer.chomp("\n").size > 0
      Reline::HISTORY << whole_buffer
    end
    line_editor.reset_line if line_editor.whole_buffer.nil?
    whole_buffer
  end
end

def special_prefixes=(v)

def special_prefixes=(v)
  @special_prefixes = v.encode(encoding)
end

def vi_editing_mode

def vi_editing_mode
  config.editing_mode = :vi_insert
  nil
end

def vi_editing_mode?

def vi_editing_mode?
  config.editing_mode_is?(:vi_insert, :vi_command)
end