class Reline::Core

Constants

ATTR_READER_NAMES
DialogProc

Attributes

config[RW]
key_stroke[RW]
line_editor[RW]
output[R]

Public Class Methods

new() { |self| ... } click to toggle source
# File reline.rb, line 61
def initialize
  self.output = STDOUT
  @dialog_proc_list = {}
  yield self
  @completion_quote_character = nil
  @bracketed_paste_finished = false
end

Public Instance Methods

add_dialog_proc(name_sym, p, context = nil) click to toggle source
# File reline.rb, line 159
def add_dialog_proc(name_sym, p, context = nil)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  raise ArgumentError unless name_sym.instance_of?(Symbol)
  @dialog_proc_list[name_sym] = DialogProc.new(p, context)
end
ambiguous_width() click to toggle source
# File reline.rb, line 463
def ambiguous_width
  may_req_ambiguous_char_width unless defined? @ambiguous_width
  @ambiguous_width
end
auto_indent_proc=(p) click to toggle source
# File reline.rb, line 144
def auto_indent_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @auto_indent_proc = p
end
autocompletion() click to toggle source
# File reline.rb, line 126
def autocompletion
  @config.autocompletion
end
autocompletion=(val) click to toggle source
# File reline.rb, line 130
def autocompletion=(val)
  @config.autocompletion = val
end
basic_quote_characters=(v) click to toggle source
# File reline.rb, line 93
def basic_quote_characters=(v)
  @basic_quote_characters = v.encode(Reline::IOGate.encoding)
end
basic_word_break_characters=(v) click to toggle source
# File reline.rb, line 85
def basic_word_break_characters=(v)
  @basic_word_break_characters = v.encode(Reline::IOGate.encoding)
end
completer_quote_characters=(v) click to toggle source
# File reline.rb, line 97
def completer_quote_characters=(v)
  @completer_quote_characters = v.encode(Reline::IOGate.encoding)
end
completer_word_break_characters=(v) click to toggle source
# File reline.rb, line 89
def completer_word_break_characters=(v)
  @completer_word_break_characters = v.encode(Reline::IOGate.encoding)
end
completion_append_character=(val) click to toggle source
# File reline.rb, line 73
def completion_append_character=(val)
  if val.nil?
    @completion_append_character = nil
  elsif val.size == 1
    @completion_append_character = val.encode(Reline::IOGate.encoding)
  elsif val.size > 1
    @completion_append_character = val[0].encode(Reline::IOGate.encoding)
  else
    @completion_append_character = nil
  end
end
completion_case_fold() click to toggle source
# File reline.rb, line 113
def completion_case_fold
  @config.completion_ignore_case
end
completion_case_fold=(v) click to toggle source
# File reline.rb, line 109
def completion_case_fold=(v)
  @config.completion_ignore_case = v
end
completion_proc=(p) click to toggle source
# File reline.rb, line 121
def completion_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @completion_proc = p
end
completion_quote_character() click to toggle source
# File reline.rb, line 117
def completion_quote_character
  @completion_quote_character
end
dialog_proc(name_sym) click to toggle source
# File reline.rb, line 165
def dialog_proc(name_sym)
  @dialog_proc_list[name_sym]
end
dig_perfect_match_proc=(p) click to toggle source
# File reline.rb, line 153
def dig_perfect_match_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @dig_perfect_match_proc = p
end
emacs_editing_mode() click to toggle source
# File reline.rb, line 193
def emacs_editing_mode
  config.editing_mode = :emacs
  nil
end
emacs_editing_mode?() click to toggle source
# File reline.rb, line 202
def emacs_editing_mode?
  config.editing_mode_is?(:emacs)
end
encoding() click to toggle source
# File reline.rb, line 69
def encoding
  Reline::IOGate.encoding
end
filename_quote_characters=(v) click to toggle source
# File reline.rb, line 101
def filename_quote_characters=(v)
  @filename_quote_characters = v.encode(Reline::IOGate.encoding)
end
get_screen_size() click to toggle source
# File reline.rb, line 206
def get_screen_size
  Reline::IOGate.get_screen_size
end
input=(val) click to toggle source
# File reline.rb, line 169
def input=(val)
  raise TypeError unless val.respond_to?(:getc) or val.nil?
  if val.respond_to?(:getc)
    if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
      Reline::ANSI.input = val
    elsif Reline::IOGate == Reline::GeneralIO
      Reline::GeneralIO.input = val
    end
  end
end
output=(val) click to toggle source
# File reline.rb, line 180
def output=(val)
  raise TypeError unless val.respond_to?(:write) or val.nil?
  @output = val
  if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
    Reline::ANSI.output = val
  end
end
output_modifier_proc=(p) click to toggle source
# File reline.rb, line 134
def output_modifier_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @output_modifier_proc = p
end
pre_input_hook=(p) click to toggle source
# File reline.rb, line 149
def pre_input_hook=(p)
  @pre_input_hook = p
end
prompt_proc=(p) click to toggle source
# File reline.rb, line 139
def prompt_proc=(p)
  raise ArgumentError unless p.respond_to?(:call) or p.nil?
  @prompt_proc = p
end
readline(prompt = '', add_hist = false) click to toggle source
# File reline.rb, line 266
def readline(prompt = '', add_hist = false)
  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
readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination) click to toggle source
# File reline.rb, line 250
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
  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
special_prefixes=(v) click to toggle source
# File reline.rb, line 105
def special_prefixes=(v)
  @special_prefixes = v.encode(Reline::IOGate.encoding)
end
vi_editing_mode() click to toggle source
# File reline.rb, line 188
def vi_editing_mode
  config.editing_mode = :vi_insert
  nil
end
vi_editing_mode?() click to toggle source
# File reline.rb, line 198
def vi_editing_mode?
  config.editing_mode_is?(:vi_insert, :vi_command)
end