mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Combine common logic into one
https://github.com/ruby/reline/commit/5db9738f17
This commit is contained in:
parent
f94a2adf6a
commit
2bc6b07a8d
1 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue