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

Implement re-read-init-file #740

Merged
merged 1 commit into from
Aug 31, 2024
Merged

Conversation

ima1zumi
Copy link
Member

@ima1zumi ima1zumi commented Aug 29, 2024

I implemented re-read-init-file to reload .inputrc.

The default key bindings are not set because they can’t be configured in the current Reline. Given the low usage of inputrc, I believe it’s unnecessary to include them. This was mainly implemented for debugging.

I haven’t written tests for this since I’m unsure how to test inputrc changes. Any suggestions are welcome.

@ima1zumi ima1zumi marked this pull request as ready for review August 29, 2024 17:43
@tompng
Copy link
Member

tompng commented Aug 30, 2024

The code and the behavior looks good 👍
There are some differences between readline and reline's reload but I think reline's implementation is better. (readline does not reset before reload).

Test

How about adding to test_config.rb with reference to def test_inputrc

Write content to inputrc file in tmpdir, call @config.read and @config.reload, and then check variable (for example: @config.emacs_mode_string) specified in inputrc.

inputrc = "#{tmpdir}/inputrc"
ENV['INPUTRC'] = inputrc
File.write(inputrc, "old content")
@config.read
File.write(inputrc, "new content")
@config.reload
# test new value loaded, test old value not kept.

@ima1zumi
Copy link
Member Author

Write content to inputrc file in tmpdir, call @config.read and @config.reload, and then check variable (for example: @config.emacs_mode_string) specified in inputrc.

Thank you! I added a test.

Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@tompng tompng merged commit 59e4ade into ruby:master Aug 31, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Aug 31, 2024
@ima1zumi ima1zumi added the enhancement New feature or request label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants