diff options
author | aycabta <aycabta@gmail.com> | 2020-01-25 23:50:10 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-01-26 12:50:11 +0900 |
commit | 8f4beec15291b1fae80be42685c61a6e5f9ce369 (patch) | |
tree | 24e89c62782f7931979519a4adca1e197b53de1f | |
parent | af64d3bc6ead0778e8265fec4b0aea4d487b7b9c (diff) | |
download | ruby-8f4beec15291b1fae80be42685c61a6e5f9ce369.tar.gz |
Always refer to Reline::IOGate.encoding
-rw-r--r-- | lib/reline.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index ee4d1c4180..bcb3af58bf 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -38,49 +38,51 @@ module Reline attr_accessor :ambiguous_width attr_accessor :last_incremental_search attr_reader :output - attr_reader :encoding - def initialize(encoding) - @encoding = encoding + def initialize self.output = STDOUT yield self @completion_quote_character = nil end + def encoding + Reline::IOGate.encoding + end + def completion_append_character=(val) if val.nil? @completion_append_character = nil elsif val.size == 1 - @completion_append_character = val.encode(@encoding) + @completion_append_character = val.encode(Reline::IOGate.encoding) elsif val.size > 1 - @completion_append_character = val[0].encode(@encoding) + @completion_append_character = val[0].encode(Reline::IOGate.encoding) else @completion_append_character = nil end end def basic_word_break_characters=(v) - @basic_word_break_characters = v.encode(@encoding) + @basic_word_break_characters = v.encode(Reline::IOGate.encoding) end def completer_word_break_characters=(v) - @completer_word_break_characters = v.encode(@encoding) + @completer_word_break_characters = v.encode(Reline::IOGate.encoding) end def basic_quote_characters=(v) - @basic_quote_characters = v.encode(@encoding) + @basic_quote_characters = v.encode(Reline::IOGate.encoding) end def completer_quote_characters=(v) - @completer_quote_characters = v.encode(@encoding) + @completer_quote_characters = v.encode(Reline::IOGate.encoding) end def filename_quote_characters=(v) - @filename_quote_characters = v.encode(@encoding) + @filename_quote_characters = v.encode(Reline::IOGate.encoding) end def special_prefixes=(v) - @special_prefixes = v.encode(@encoding) + @special_prefixes = v.encode(Reline::IOGate.encoding) end def completion_case_fold=(v) @@ -203,7 +205,7 @@ module Reline otio = Reline::IOGate.prep may_req_ambiguous_char_width - line_editor.reset(prompt, encoding: @encoding) + line_editor.reset(prompt, encoding: Reline::IOGate.encoding) if multiline line_editor.multiline_on if block_given? @@ -394,7 +396,7 @@ module Reline end def self.core - @core ||= Core.new(Reline::IOGate.encoding) { |core| + @core ||= Core.new { |core| core.config = Reline::Config.new core.key_stroke = Reline::KeyStroke.new(core.config) core.line_editor = Reline::LineEditor.new(core.config, Reline::IOGate.encoding) |