diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 16ed7eee05..6168001247 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -29,6 +29,17 @@ class InvalidInputrc < RuntimeError attr_accessor :autocompletion def initialize + reset_variables + end + + def reset + if editing_mode_is?(:vi_command) + @editing_mode_label = :vi_insert + end + @oneshot_key_bindings.clear + end + + def reset_variables @additional_key_bindings = { # from inputrc emacs: Reline::KeyActor::Base.new, vi_insert: Reline::KeyActor::Base.new, @@ -54,13 +65,7 @@ def initialize @convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding) @loaded = false @enable_bracketed_paste = true - end - - def reset - if editing_mode_is?(:vi_command) - @editing_mode_label = :vi_insert - end - @oneshot_key_bindings.clear + @show_mode_in_prompt = false end def editing_mode @@ -360,6 +365,12 @@ def parse_keyseq(str) ret end + def reload + reset_variables + @loaded = false + read + end + private def seven_bit_encoding?(encoding) encoding == Encoding::US_ASCII end diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 9c97415050..5f7f00c979 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -2554,4 +2554,8 @@ def finish private def set_next_action_state(type, value) @next_action_state = [type, value] end + + private def re_read_init_file(_key) + @config.reload + end end