зеркало из https://github.com/github/ruby.git
[ruby/reline] Combine common logic into one
https://github.com/ruby/reline/commit/5db9738f17
This commit is contained in:
Родитель
f94a2adf6a
Коммит
2bc6b07a8d
|
@ -466,20 +466,12 @@ class Reline::LineEditor
|
|||
new_highest_in_this = calculate_height_by_width(prompt_width + calculate_width(@line.nil? ? '' : @line))
|
||||
rendered = false
|
||||
if @add_newline_to_end_of_buffer
|
||||
@dialogs.each do |dialog|
|
||||
clear_each_dialog(dialog)
|
||||
dialog.contents = nil
|
||||
dialog.trap_key = nil
|
||||
end
|
||||
clear_dialog_with_content
|
||||
rerender_added_newline(prompt, prompt_width)
|
||||
@add_newline_to_end_of_buffer = false
|
||||
else
|
||||
if @just_cursor_moving and not @rerender_all
|
||||
@dialogs.each do |dialog|
|
||||
clear_each_dialog(dialog)
|
||||
dialog.contents = nil
|
||||
dialog.trap_key = nil
|
||||
end
|
||||
clear_dialog_with_content
|
||||
rendered = just_move_cursor
|
||||
@just_cursor_moving = false
|
||||
return
|
||||
|
@ -892,6 +884,14 @@ class Reline::LineEditor
|
|||
end
|
||||
end
|
||||
|
||||
private def clear_dialog_with_content
|
||||
@dialogs.each do |dialog|
|
||||
clear_each_dialog(dialog)
|
||||
dialog.contents = nil
|
||||
dialog.trap_key = nil
|
||||
end
|
||||
end
|
||||
|
||||
private def clear_each_dialog(dialog)
|
||||
dialog.trap_key = nil
|
||||
return unless dialog.contents
|
||||
|
|
Загрузка…
Ссылка в новой задаче