diff options
author | aycabta <aycabta@gmail.com> | 2021-08-29 19:27:04 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-08-29 20:30:33 +0900 |
commit | 29586ec9f3836afbfd9a48c30782fd178045e0c3 (patch) | |
tree | ab0a1787d6d222e31401213d6287b1403563a638 /lib | |
parent | b023ef85947530e256f12c8a7809d79a5639414d (diff) | |
download | ruby-29586ec9f3836afbfd9a48c30782fd178045e0c3.tar.gz |
[ruby/reline] Use default dialog context to communicate others
https://github.com/ruby/reline/commit/5e67e6ffe0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index cb51738958..0ff4c31040 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -209,10 +209,13 @@ module Reline 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 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 |