You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the prompt, if a user just types TAB, I want to display all completions available. It appears that reline only displays completions if there is something typed at the prompt.
Here is an example that illustrates the issue from ChatGPT:
#!/usr/bin/env ruby
require 'reline'
# Force Emacs mode so that Tab completion is the standard behavior
# (In some Reline versions these are just methods, not setters)
Reline.emacs_editing_mode
# A debug completion function that prints when it's called:
def debug_completion(input)
warn "[DEBUG] completion_proc called with '#{input.inspect}'"
if input.empty?
%w[apple banana cherry]
else
%w[apple banana cherry].grep(/^#{Regexp.escape(input)}/)
end
end
Reline.completion_proc = method(:debug_completion)
loop do
line = Reline.readline("> ", true)
break if line.nil? || line.strip.downcase == "exit"
puts "You typed: #{line}"
end
Hitting TAB and nothing else at the prompt should offer 'apple', 'banana', and 'cherry', but it offers nothing.
The text was updated successfully, but these errors were encountered:
At the prompt, if a user just types TAB, I want to display all completions available. It appears that reline only displays completions if there is something typed at the prompt.
Here is an example that illustrates the issue from ChatGPT:
Hitting TAB and nothing else at the prompt should offer 'apple', 'banana', and 'cherry', but it offers nothing.
The text was updated successfully, but these errors were encountered: