diff options
author | aycabta <[email protected]> | 2021-12-08 01:44:18 +0900 |
---|---|---|
committer | git <[email protected]> | 2021-12-13 20:44:21 +0900 |
commit | 8411e8449b17357221b69617214674fb101c766d (patch) | |
tree | d530ff4b2218e4be572922ae44831395d920b2f8 /lib/reline/line_editor.rb | |
parent | 446a11f2c1a1af007ef6079eada2d8992a13467f (diff) |
[ruby/reline] Remove unnecessary variables, lower_space
The number of lines below the cursor position was known by
"@rest_height" alone, but the problem was caused by adding
"lower_space". Remove "lower_space" as it is unnecessary.
https://github.com/ruby/reline/commit/a575cef6a3
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 50bd22b424..39e2b427bc 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -706,19 +706,18 @@ class Reline::LineEditor dialog.scrollbar_pos = nil 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 dialog.width += @block_elem_width if dialog.scrollbar_pos diff = (dialog.column + dialog.width) - (@screen_size.last) if diff > 0 dialog.column -= diff end - if (lower_space + @rest_height - dialog_render_info.pos.y) >= height + if (@rest_height - dialog_render_info.pos.y) >= height dialog.vertical_offset = dialog_render_info.pos.y + 1 elsif upper_space >= height dialog.vertical_offset = dialog_render_info.pos.y - height else - if (lower_space + @rest_height - dialog_render_info.pos.y) < height + if (@rest_height - dialog_render_info.pos.y) < height scroll_down(height + dialog_render_info.pos.y) move_cursor_up(height + dialog_render_info.pos.y) end |