1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Add config.autocompletion

3d918e4ccb
This commit is contained in:
aycabta 2021-08-30 01:23:20 +09:00
parent 60eb328d42
commit 11b825076b
2 changed files with 14 additions and 1 deletions

View file

@ -65,6 +65,7 @@ class Reline::Config
@history_size = -1 # unlimited
@keyseq_timeout = 500
@test_mode = false
@autocompletion = true
end
def reset
@ -89,6 +90,14 @@ class Reline::Config
(val.respond_to?(:any?) ? val : [val]).any?(@editing_mode_label)
end
def autocompletion=(val)
@autocompletion = val
end
def autocompletion
@autocompletion
end
def keymap
@key_actors[@keymap_label]
end

View file

@ -1426,7 +1426,11 @@ class Reline::LineEditor
if result.is_a?(Array)
completion_occurs = true
process_insert
complete(result)
if @config.autocompletion
move_completed_list(result, :down)
else
complete(result)
end
end
end
elsif not @config.disable_completion and @config.editing_mode_is?(:vi_insert) and ["\C-p".ord, "\C-n".ord].include?(key.char)