Module: Readline

Defined in:
lib/termtter/system_extensions/windows.rb,
lib/termtter/system_extensions.rb,
lib/termtter/system_extensions.rb

Constant Summary collapse

NATIVE_REFRESH_LINE_METHOD =

Latest 'readline.so' has native 'refresh_line' method.

Readline.respond_to?(:refresh_line)

Class Method Summary collapse

Class Method Details

.old_readlineObject


9
# File 'lib/termtter/system_extensions/windows.rb', line 9

alias :old_readline :readline

.readline(*a) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/termtter/system_extensions/windows.rb', line 10

def readline(*a)
  str = old_readline(*a)
  out = ''
  loop do
    begin
      out << $iconv_sj_to_u8.iconv(str)
      break
    rescue Iconv::Failure
      out << "#{$!.success}?"
      str = $!.failed[1..-1]
    end
  end
  return out
end

.refresh_lineObject


21
22
# File 'lib/termtter/system_extensions.rb', line 21

def self.refresh_line
end

.rl_parse_and_bind(str) ⇒ Object


18
19
20
# File 'lib/termtter/system_extensions.rb', line 18

def self.rl_parse_and_bind(str)
  str
end