[前][次][番号順一覧][スレッド一覧]

ruby-changes:67291

From: aycabta <ko1@a...>
Date: Sun, 29 Aug 2021 20:30:36 +0900 (JST)
Subject: [ruby-changes:67291] e66200780b (master): [ruby/reline] Separate calling completion proc with checking args

https://git.ruby-lang.org/ruby.git/commit/?id=e66200780b

From e66200780b5a07c070295231408873c8d3dd7c5e Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 15 Aug 2021 17:08:58 +0900
Subject: [ruby/reline] Separate calling completion proc with checking args

https://github.com/ruby/reline/commit/3203cb97db
---
 lib/reline/line_editor.rb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 97f1211..0b5b683 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1165,7 +1165,13 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L1165
 
   def call_completion_proc
     result = retrieve_completion_block(true)
-    preposing, target, postposing = result
+    pre, target, post = result
+    result = call_completion_proc_with_checking_args(pre, target, post)
+    Reline.core.instance_variable_set(:@completion_quote_character, nil)
+    result
+  end
+
+  private def call_completion_proc_with_checking_args(pre, target, post)
     if @completion_proc and target
       argnum = @completion_proc.parameters.inject(0) { |result, item|
         case item.first
@@ -1179,12 +1185,11 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L1185
       when 1
         result = @completion_proc.(target)
       when 2
-        result = @completion_proc.(target, preposing)
+        result = @completion_proc.(target, pre)
       when 3..Float::INFINITY
-        result = @completion_proc.(target, preposing, postposing)
+        result = @completion_proc.(target, pre, post)
       end
     end
-    Reline.core.instance_variable_set(:@completion_quote_character, nil)
     result
   end
 
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]