diff options
| author | Mari Imaizumi <mariimaizumi5@gmail.com> | 2024-08-31 12:26:47 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-08-31 03:26:50 +0000 |
| commit | a2b3cb65ea4d8b9f2d57f027531875bcaab812bf (patch) | |
| tree | daff24a9d40b5451e6c2436dffce07e9cb082e5c /lib | |
| parent | f1a7966187886e5b62e22126bd7e83fb005973a2 (diff) | |
[ruby/reline] Implement re-read-init-file
(https://github.com/ruby/reline/pull/740)
https://github.com/ruby/reline/commit/59e4ade807
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/reline/config.rb | 24 | ||||
| -rw-r--r-- | lib/reline/line_editor.rb | 4 |
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 16ed7eee05..12b2d22237 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -29,6 +29,17 @@ class Reline::Config 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 @@ class Reline::Config @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,11 @@ class Reline::Config ret end + def reload + reset_variables + 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 @@ class Reline::LineEditor 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 |
