Always refer to Reline::IOGate.encoding
This commit is contained in:
parent
af64d3bc6e
commit
8f4beec152
@ -38,49 +38,51 @@ module Reline
|
|||||||
attr_accessor :ambiguous_width
|
attr_accessor :ambiguous_width
|
||||||
attr_accessor :last_incremental_search
|
attr_accessor :last_incremental_search
|
||||||
attr_reader :output
|
attr_reader :output
|
||||||
attr_reader :encoding
|
|
||||||
|
|
||||||
def initialize(encoding)
|
def initialize
|
||||||
@encoding = encoding
|
|
||||||
self.output = STDOUT
|
self.output = STDOUT
|
||||||
yield self
|
yield self
|
||||||
@completion_quote_character = nil
|
@completion_quote_character = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def encoding
|
||||||
|
Reline::IOGate.encoding
|
||||||
|
end
|
||||||
|
|
||||||
def completion_append_character=(val)
|
def completion_append_character=(val)
|
||||||
if val.nil?
|
if val.nil?
|
||||||
@completion_append_character = nil
|
@completion_append_character = nil
|
||||||
elsif val.size == 1
|
elsif val.size == 1
|
||||||
@completion_append_character = val.encode(@encoding)
|
@completion_append_character = val.encode(Reline::IOGate.encoding)
|
||||||
elsif val.size > 1
|
elsif val.size > 1
|
||||||
@completion_append_character = val[0].encode(@encoding)
|
@completion_append_character = val[0].encode(Reline::IOGate.encoding)
|
||||||
else
|
else
|
||||||
@completion_append_character = nil
|
@completion_append_character = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def basic_word_break_characters=(v)
|
def basic_word_break_characters=(v)
|
||||||
@basic_word_break_characters = v.encode(@encoding)
|
@basic_word_break_characters = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def completer_word_break_characters=(v)
|
def completer_word_break_characters=(v)
|
||||||
@completer_word_break_characters = v.encode(@encoding)
|
@completer_word_break_characters = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def basic_quote_characters=(v)
|
def basic_quote_characters=(v)
|
||||||
@basic_quote_characters = v.encode(@encoding)
|
@basic_quote_characters = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def completer_quote_characters=(v)
|
def completer_quote_characters=(v)
|
||||||
@completer_quote_characters = v.encode(@encoding)
|
@completer_quote_characters = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def filename_quote_characters=(v)
|
def filename_quote_characters=(v)
|
||||||
@filename_quote_characters = v.encode(@encoding)
|
@filename_quote_characters = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def special_prefixes=(v)
|
def special_prefixes=(v)
|
||||||
@special_prefixes = v.encode(@encoding)
|
@special_prefixes = v.encode(Reline::IOGate.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def completion_case_fold=(v)
|
def completion_case_fold=(v)
|
||||||
@ -203,7 +205,7 @@ module Reline
|
|||||||
otio = Reline::IOGate.prep
|
otio = Reline::IOGate.prep
|
||||||
|
|
||||||
may_req_ambiguous_char_width
|
may_req_ambiguous_char_width
|
||||||
line_editor.reset(prompt, encoding: @encoding)
|
line_editor.reset(prompt, encoding: Reline::IOGate.encoding)
|
||||||
if multiline
|
if multiline
|
||||||
line_editor.multiline_on
|
line_editor.multiline_on
|
||||||
if block_given?
|
if block_given?
|
||||||
@ -394,7 +396,7 @@ module Reline
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.core
|
def self.core
|
||||||
@core ||= Core.new(Reline::IOGate.encoding) { |core|
|
@core ||= Core.new { |core|
|
||||||
core.config = Reline::Config.new
|
core.config = Reline::Config.new
|
||||||
core.key_stroke = Reline::KeyStroke.new(core.config)
|
core.key_stroke = Reline::KeyStroke.new(core.config)
|
||||||
core.line_editor = Reline::LineEditor.new(core.config, Reline::IOGate.encoding)
|
core.line_editor = Reline::LineEditor.new(core.config, Reline::IOGate.encoding)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user