1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Remove one unnecessary nest for simplicity's sake

f4bda85a7c
This commit is contained in:
aycabta 2021-08-31 20:48:58 +09:00 committed by git
parent 64373a3c58
commit 9b188ac238

View file

@ -589,8 +589,19 @@ class Reline::LineEditor
end
dialog.set_cursor_pos(cursor_column, @first_line_started_from + @started_from)
dialog_render_info = dialog.call
if dialog_render_info.nil? or dialog_render_info.contents.nil? or dialog_render_info.contents.empty?
dialog.lines_backup = {
lines: modify_lines(whole_lines),
line_index: @line_index,
first_line_started_from: @first_line_started_from,
started_from: @started_from,
byte_pointer: @byte_pointer
}
clear_each_dialog(dialog)
dialog.contents = nil
return
end
old_dialog = dialog.clone
if dialog_render_info and dialog_render_info.contents and not dialog_render_info.contents.empty?
dialog.width = dialog_render_info.width if dialog_render_info.width
height = dialog_render_info.height || DIALOG_HEIGHT
pointer = dialog_render_info.pointer
@ -608,18 +619,6 @@ class Reline::LineEditor
end
dialog.contents = dialog.contents[dialog.scroll_top, height]
end
else
dialog.lines_backup = {
lines: modify_lines(whole_lines),
line_index: @line_index,
first_line_started_from: @first_line_started_from,
started_from: @started_from,
byte_pointer: @byte_pointer
}
clear_each_dialog(dialog)
dialog.contents = nil
return
end
upper_space = @first_line_started_from - @started_from
lower_space = @highest_in_all - @first_line_started_from - @started_from - 1
dialog.column = dialog_render_info.pos.x