diff options
author | aycabta <aycabta@gmail.com> | 2019-05-14 01:10:15 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-14 07:15:41 +0900 |
commit | af1f3f131f6a82f5f06fe5b3adeb6f80cf86b941 (patch) | |
tree | 7c619833a6d052bdab7bdf68c83e270b81914ce0 /lib/reline.rb | |
parent | 741321704fa1e4f180c853684a8ceaa6eff3b469 (diff) | |
download | ruby-af1f3f131f6a82f5f06fe5b3adeb6f80cf86b941.tar.gz |
Readline's class vars should be encoded as default_external
Diffstat (limited to 'lib/reline.rb')
-rw-r--r-- | lib/reline.rb | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 2639021863..938eb955bb 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -18,16 +18,6 @@ module Reline CursorPos = Struct.new(:x, :y) - class << self - attr_accessor :basic_quote_characters - attr_accessor :completer_quote_characters - attr_accessor :completer_word_break_characters - attr_reader :completion_append_character - attr_accessor :completion_case_fold - attr_accessor :filename_quote_characters - attr_accessor :special_prefixes - end - @@config = Reline::Config.new @@line_editor = Reline::LineEditor.new(@@config) @@ambiguous_width = nil @@ -68,22 +58,19 @@ module Reline end }.new - @basic_quote_characters = '"\'' - # TODO implement below - #@completer_quote_characters - #@completion_append_character - #@completion_case_fold - #@filename_quote_characters - #@special_prefixes + @@completion_append_character = nil + def self.completion_append_character + @@completion_append_character + end def self.completion_append_character=(val) if val.nil? - @completion_append_character = nil + @@completion_append_character = nil elsif val.size == 1 - @completion_append_character = val + @@completion_append_character = val.encode(Encoding::default_external) elsif val.size > 1 - @completion_append_character = val[0] + @@completion_append_character = val[0].encode(Encoding::default_external) else - @completion_append_character = nil + @@completion_append_character = nil end end @@ -92,10 +79,56 @@ module Reline @@basic_word_break_characters end def self.basic_word_break_characters=(v) - @@basic_word_break_characters = v + @@basic_word_break_characters = v.encode(Encoding::default_external) end @@completer_word_break_characters = @@basic_word_break_characters.dup + def self.completer_word_break_characters + @@completer_word_break_characters + end + def self.completer_word_break_characters=(v) + @@completer_word_break_characters = v.encode(Encoding::default_external) + end + + @@basic_quote_characters = '"\'' + def self.basic_quote_characters + @@basic_quote_characters + end + def self.basic_quote_characters=(v) + @@basic_quote_characters = v.encode(Encoding::default_external) + end + + @@completer_quote_characters = '"\'' + def self.completer_quote_characters + @@completer_quote_characters + end + def self.completer_quote_characters=(v) + @@completer_quote_characters = v.encode(Encoding::default_external) + end + + @@filename_quote_characters = '' + def self.filename_quote_characters + @@filename_quote_characters + end + def self.filename_quote_characters=(v) + @@filename_quote_characters = v.encode(Encoding::default_external) + end + + @@special_prefixes = '' + def self.special_prefixes + @@special_prefixes + end + def self.special_prefixes=(v) + @@special_prefixes = v.encode(Encoding::default_external) + end + + @@completion_case_fold = nil + def self.completion_case_fold + @@completion_case_fold + end + def self.completion_case_fold=(v) + @@completion_case_fold = v + end @@completion_proc = nil def self.completion_proc |