summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-03-20 10:39:08 +0900
committergit <svn-admin@ruby-lang.org>2024-03-20 01:39:12 +0000
commitaa2cdaa2637853892bb4839dfd66f35913c36123 (patch)
tree74975fa5643cf1c84814cefddedb73bc0fd8e7cb
parent0a1070274754d89a35c48deb6e65ea44f4fb118d (diff)
[ruby/reline] Change rendered_screen.lines to non-nil
(https://github.com/ruby/reline/pull/650) https://github.com/ruby/reline/commit/9685db55f1
-rw-r--r--lib/reline/line_editor.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 2d30f69d23..c6360e56b0 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -153,7 +153,7 @@ class Reline::LineEditor
scroll_into_view
Reline::IOGate.move_cursor_up @rendered_screen.cursor_y
@rendered_screen.base_y = Reline::IOGate.cursor_pos.y
- @rendered_screen.lines = nil
+ @rendered_screen.lines = []
@rendered_screen.cursor_y = 0
render_differential
end
@@ -164,7 +164,7 @@ class Reline::LineEditor
scrolldown = render_differential
Reline::IOGate.scroll_down scrolldown
Reline::IOGate.move_cursor_column 0
- @rendered_screen.lines = nil
+ @rendered_screen.lines = []
@rendered_screen.cursor_y = 0
case @old_trap
when 'DEFAULT', 'SYSTEM_DEFAULT'
@@ -217,7 +217,7 @@ class Reline::LineEditor
@dialogs = []
@resized = false
@cache = {}
- @rendered_screen = RenderedScreen.new(base_y: 0, lines: nil, cursor_y: 0)
+ @rendered_screen = RenderedScreen.new(base_y: 0, lines: [], cursor_y: 0)
reset_line
end
@@ -421,7 +421,7 @@ class Reline::LineEditor
Reline::IOGate.move_cursor_up @rendered_screen.cursor_y
Reline::IOGate.move_cursor_column 0
- num_lines = @rendered_screen.lines&.size
+ num_lines = @rendered_screen.lines.size
return unless num_lines && num_lines >= 1
Reline::IOGate.move_cursor_down num_lines - 1
@@ -430,7 +430,7 @@ class Reline::LineEditor
Reline::IOGate.move_cursor_up 1
end
Reline::IOGate.erase_after_cursor
- @rendered_screen.lines = nil
+ @rendered_screen.lines = []
@rendered_screen.cursor_y = 0
end
@@ -455,7 +455,7 @@ class Reline::LineEditor
def render_differential
wrapped_cursor_x, wrapped_cursor_y = wrapped_cursor_position
- rendered_lines = @rendered_screen.lines || []
+ rendered_lines = @rendered_screen.lines
new_lines = wrapped_lines.flatten[screen_scroll_top, screen_height].map do |l|
[[0, Reline::Unicode.calculate_width(l, true), l]]
end
@@ -528,7 +528,7 @@ class Reline::LineEditor
@cleared = false
Reline::IOGate.clear_screen
@screen_size = Reline::IOGate.get_screen_size
- @rendered_screen.lines = nil
+ @rendered_screen.lines = []
@rendered_screen.base_y = 0
@rendered_screen.cursor_y = 0
end