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

ruby-changes:67328

From: aycabta <ko1@a...>
Date: Sun, 29 Aug 2021 20:31:18 +0900 (JST)
Subject: [ruby-changes:67328] 29586ec9f3 (master): [ruby/reline] Use default dialog context to communicate others

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

From 29586ec9f3836afbfd9a48c30782fd178045e0c3 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 29 Aug 2021 19:27:04 +0900
Subject: [ruby/reline] Use default dialog context to communicate others

https://github.com/ruby/reline/commit/5e67e6ffe0
---
 lib/reline.rb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/reline.rb b/lib/reline.rb
index cb51738..0ff4c31 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -209,10 +209,13 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L209
         y = 0
       end
       cursor_pos_to_render = Reline::CursorPos.new(x, y)
-      context.clear
-      context.push(cursor_pos_to_render, result, pointer)
+      if context and context.is_a?(Array)
+        context.clear
+        context.push(cursor_pos_to_render, result, pointer)
+      end
       [cursor_pos_to_render, result, pointer, nil]
     }
+    DEFAULT_DIALOG_CONTEXT = Array.new
 
     require 'rdoc'
     SHOW_DOC_DIALOG = ->() {
@@ -255,8 +258,8 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L258
         raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
       end
       context = []
-      add_dialog_proc(:autocomplete, DEFAULT_DIALOG_PROC_AUTOCOMPLETE, context)
-      add_dialog_proc(:show_doc, SHOW_DOC_DIALOG, context)
+      add_dialog_proc(:autocomplete, DEFAULT_DIALOG_PROC_AUTOCOMPLETE, DEFAULT_DIALOG_CONTEXT)
+      add_dialog_proc(:show_doc, SHOW_DOC_DIALOG, DEFAULT_DIALOG_CONTEXT)
       inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
 
       whole_buffer = line_editor.whole_buffer.dup
-- 
cgit v1.1


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

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