From fdf88a2c10bd0dc11d1033c2281d764dfdaa00de Mon Sep 17 00:00:00 2001 From: Mari Imaizumi Date: Thu, 2 May 2024 14:50:04 +0900 Subject: [ruby/reline] Avoid reading .inputrc repeatedly (https://github.com/ruby/reline/pull/694) https://github.com/ruby/reline/commit/c8d4802a0f --- lib/reline.rb | 2 +- lib/reline/config.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3