diff options
| author | Mari Imaizumi <mariimaizumi5@gmail.com> | 2024-05-02 14:50:04 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-02 05:50:08 +0000 |
| commit | fdf88a2c10bd0dc11d1033c2281d764dfdaa00de (patch) | |
| tree | 6e58c7a7b55a63de4d150191e58707018e876bda | |
| parent | fcd89bf6682a4f488714c9e9ffe3e3d7957a72c9 (diff) | |
[ruby/reline] Avoid reading .inputrc repeatedly
(https://github.com/ruby/reline/pull/694)
https://github.com/ruby/reline/commit/c8d4802a0f
| -rw-r--r-- | lib/reline.rb | 2 | ||||
| -rw-r--r-- | lib/reline/config.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 0a266b9c58..7774572f92 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -338,7 +338,7 @@ module Reline end end - unless config.test_mode + unless config.test_mode or config.loaded? config.read config.reset_default_key_bindings io_gate.set_default_key_bindings(config) diff --git a/lib/reline/config.rb b/lib/reline/config.rb index bec1ca178d..58bf09ac02 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -69,6 +69,7 @@ class Reline::Config @test_mode = false @autocompletion = false @convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding) + @loaded = false end def reset @@ -98,6 +99,10 @@ class Reline::Config @key_actors[@keymap_label] end + def loaded? + @loaded + end + def inputrc_path case ENV['INPUTRC'] when nil, '' @@ -141,6 +146,7 @@ class Reline::Config end read_lines(lines, file) + @loaded = true self rescue InvalidInputrc => e warn e.message |
