Skip to content

Commit

Permalink
Use default dialog context to communicate others
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Aug 29, 2021
1 parent f66a079 commit 5e67e6f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/reline.rb
Expand Up @@ -209,10 +209,13 @@ def get_screen_size
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 = ->() {
Expand Down Expand Up @@ -255,8 +258,8 @@ def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
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
Expand Down

0 comments on commit 5e67e6f

Please sign in to comment.