mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 22:45:03 +02:00
parent
164e486225
commit
acffb0b068
1 changed files with 33 additions and 31 deletions
|
@ -177,18 +177,14 @@ module Reline
|
||||||
Reline::IOGate.get_screen_size
|
Reline::IOGate.get_screen_size
|
||||||
end
|
end
|
||||||
|
|
||||||
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
DEFAULT_DIALOG_PROC_AUTOCOMPLETE = ->() {
|
||||||
unless confirm_multiline_termination
|
|
||||||
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
|
|
||||||
end
|
|
||||||
@dialog_proc = ->() {
|
|
||||||
# autocomplete
|
# autocomplete
|
||||||
if just_cursor_moving and completion_journey_data.nil?
|
if just_cursor_moving and completion_journey_data.nil?
|
||||||
# Auto complete starts only when edited
|
# Auto complete starts only when edited
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
pre, target, post= retrieve_completion_block(true)
|
pre, target, post= retrieve_completion_block(true)
|
||||||
if target.nil? or target.empty?
|
if target.nil? or target.empty?# or target.size <= 3
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
if completion_journey_data and completion_journey_data.list
|
if completion_journey_data and completion_journey_data.list
|
||||||
|
@ -212,6 +208,12 @@ module Reline
|
||||||
end
|
end
|
||||||
[Reline::CursorPos.new(x, y), result, pointer]
|
[Reline::CursorPos.new(x, y), result, pointer]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
||||||
|
unless confirm_multiline_termination
|
||||||
|
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
|
||||||
|
end
|
||||||
|
@dialog_proc = DEFAULT_DIALOG_PROC_AUTOCOMPLETE
|
||||||
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
|
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
|
||||||
|
|
||||||
whole_buffer = line_editor.whole_buffer.dup
|
whole_buffer = line_editor.whole_buffer.dup
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue