Skip to content

Commit 9685db5

Browse files
authoredMar 20, 2024
Change rendered_screen.lines to non-nil (#650)
1 parent 3fa3762 commit 9685db5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎lib/reline/line_editor.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def resize
153153
scroll_into_view
154154
Reline::IOGate.move_cursor_up @rendered_screen.cursor_y
155155
@rendered_screen.base_y = Reline::IOGate.cursor_pos.y
156-
@rendered_screen.lines = nil
156+
@rendered_screen.lines = []
157157
@rendered_screen.cursor_y = 0
158158
render_differential
159159
end
@@ -164,7 +164,7 @@ def set_signal_handlers
164164
scrolldown = render_differential
165165
Reline::IOGate.scroll_down scrolldown
166166
Reline::IOGate.move_cursor_column 0
167-
@rendered_screen.lines = nil
167+
@rendered_screen.lines = []
168168
@rendered_screen.cursor_y = 0
169169
case @old_trap
170170
when 'DEFAULT', 'SYSTEM_DEFAULT'
@@ -217,7 +217,7 @@ def reset_variables(prompt = '', encoding:)
217217
@dialogs = []
218218
@resized = false
219219
@cache = {}
220-
@rendered_screen = RenderedScreen.new(base_y: 0, lines: nil, cursor_y: 0)
220+
@rendered_screen = RenderedScreen.new(base_y: 0, lines: [], cursor_y: 0)
221221
reset_line
222222
end
223223

@@ -421,7 +421,7 @@ def clear_rendered_lines
421421
Reline::IOGate.move_cursor_up @rendered_screen.cursor_y
422422
Reline::IOGate.move_cursor_column 0
423423

424-
num_lines = @rendered_screen.lines&.size
424+
num_lines = @rendered_screen.lines.size
425425
return unless num_lines && num_lines >= 1
426426

427427
Reline::IOGate.move_cursor_down num_lines - 1
@@ -430,7 +430,7 @@ def clear_rendered_lines
430430
Reline::IOGate.move_cursor_up 1
431431
end
432432
Reline::IOGate.erase_after_cursor
433-
@rendered_screen.lines = nil
433+
@rendered_screen.lines = []
434434
@rendered_screen.cursor_y = 0
435435
end
436436

@@ -455,7 +455,7 @@ def print_nomultiline_prompt(prompt)
455455
def render_differential
456456
wrapped_cursor_x, wrapped_cursor_y = wrapped_cursor_position
457457

458-
rendered_lines = @rendered_screen.lines || []
458+
rendered_lines = @rendered_screen.lines
459459
new_lines = wrapped_lines.flatten[screen_scroll_top, screen_height].map do |l|
460460
[[0, Reline::Unicode.calculate_width(l, true), l]]
461461
end
@@ -528,7 +528,7 @@ def handle_cleared
528528
@cleared = false
529529
Reline::IOGate.clear_screen
530530
@screen_size = Reline::IOGate.get_screen_size
531-
@rendered_screen.lines = nil
531+
@rendered_screen.lines = []
532532
@rendered_screen.base_y = 0
533533
@rendered_screen.cursor_y = 0
534534
end

0 commit comments

Comments
 (0)