Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid reading .inputrc repeatedly #694

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def readline(prompt = '', add_hist = false)
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)
Expand Down
6 changes: 6 additions & 0 deletions lib/reline/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def initialize
@test_mode = false
@autocompletion = false
@convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
@loaded = false
end

def reset
Expand Down Expand Up @@ -98,6 +99,10 @@ def keymap
@key_actors[@keymap_label]
end

def loaded?
@loaded
end

def inputrc_path
case ENV['INPUTRC']
when nil, ''
Expand Down Expand Up @@ -141,6 +146,7 @@ def read(file = nil)
end

read_lines(lines, file)
@loaded = true
self
rescue InvalidInputrc => e
warn e.message
Expand Down
Loading