Skip to content

Commit

Permalink
Fix #271 - Readline completely deprecated in Ruby 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
abinoam committed Jul 15, 2024
1 parent 3e7c9dc commit df0fd06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/highline/terminal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_line_with_readline(question, highline)
def readline_read(question, highline)
# prep auto-completion
unless question.selection.empty?
Readline.completion_proc = lambda do |str|
Reline.completion_proc = lambda do |str|
question.selection.grep(/\A#{Regexp.escape(str)}/)
end
end
Expand All @@ -124,7 +124,7 @@ def readline_read(question, highline)

raw_answer = run_preserving_stty do
prompt = highline.render_and_ident_statement(question)
Readline.readline(prompt, true)
Reline.readline(prompt, true)
end

$VERBOSE = old_verbose
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/at_readline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"that begins with the 'l' letter in this particular case.\n\n" \
"If I don't type any character but press <TAB> two times, I should\n" \
"be able to see ALL available options.\n\n" \
"Please, play with Readline autocomplete for a while, pressing <ENTER>\n" \
"Please, play with Reline autocomplete for a while, pressing <ENTER>\n" \
"to see that it really gets the selected answer.\n" \
"When ready, just type 'exit' and the loop will finish.\n\n" \
"Don't forget to answer 'y' (yes) or 'n' (no) to the question at the end."
Expand All @@ -33,5 +33,5 @@
end
end

t.question = "Did the Readline autocomplete work fine (y/n)? "
t.question = "Did the Reline autocomplete work fine (y/n)? "
end

0 comments on commit df0fd06

Please sign in to comment.