Skip to content

Commit

Permalink
Add config.autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Aug 29, 2021
1 parent 2668715 commit 3d918e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/reline/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def initialize
@history_size = -1 # unlimited
@keyseq_timeout = 500
@test_mode = false
@autocompletion = true
end

def reset
Expand All @@ -89,6 +90,14 @@ def editing_mode_is?(*val)
(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
Expand Down
6 changes: 5 additions & 1 deletion lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,11 @@ def input_key(key)
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)
Expand Down

0 comments on commit 3d918e4

Please sign in to comment.