ruby-changes:67346
From: aycabta <ko1@a...>
Date: Mon, 30 Aug 2021 02:37:40 +0900 (JST)
Subject: [ruby-changes:67346] 11b825076b (master): [ruby/reline] Add config.autocompletion
https://git.ruby-lang.org/ruby.git/commit/?id=11b825076b From 11b825076b145fec5a27ce1ed0e8e412bd4d857a Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 30 Aug 2021 01:23:20 +0900 Subject: [ruby/reline] Add config.autocompletion https://github.com/ruby/reline/commit/3d918e4ccb --- lib/reline/config.rb | 9 +++++++++ lib/reline/line_editor.rb | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/reline/config.rb b/lib/reline/config.rb index c2b50a9..ac2a365 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -65,6 +65,7 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L65 @history_size = -1 # unlimited @keyseq_timeout = 500 @test_mode = false + @autocompletion = true end def reset @@ -89,6 +90,14 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L90 (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 diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index b5a5af3..5e3b836 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -1426,7 +1426,11 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L1426 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) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/