зеркало из https://github.com/github/ruby.git
[ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541) https://github.com/ruby/reline/commit/ad6faada3f
This commit is contained in:
Родитель
5d137a7f77
Коммит
cf0b9e0db0
|
@ -724,7 +724,7 @@ class Reline::LineEditor
|
|||
ymax = ymax.clamp(screen_y_range.begin, screen_y_range.end)
|
||||
dialog_y = @first_line_started_from + @started_from
|
||||
cursor_y = dialog_y
|
||||
if @highest_in_all < ymax
|
||||
if @highest_in_all <= ymax
|
||||
scroll_down(ymax - cursor_y)
|
||||
move_cursor_up(ymax - cursor_y)
|
||||
end
|
||||
|
|
|
@ -957,6 +957,25 @@ begin
|
|||
EOC
|
||||
end
|
||||
|
||||
def test_dialog_scroll_pushup_condition
|
||||
start_terminal(10, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
|
||||
write("\n" * 10)
|
||||
write("if 1\n sSt\nend")
|
||||
write("\C-p\C-h\C-e")
|
||||
assert_screen(<<~'EOC')
|
||||
prompt>
|
||||
prompt>
|
||||
prompt>
|
||||
prompt>
|
||||
prompt>
|
||||
prompt>
|
||||
prompt> if 1
|
||||
prompt> St
|
||||
prompt> enString
|
||||
Struct
|
||||
EOC
|
||||
end
|
||||
|
||||
def test_simple_dialog_with_scroll_screen
|
||||
start_terminal(5, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog simple}, startup_message: 'Multiline REPL.')
|
||||
write("if 1\n 2\n 3\n 4\n 5\n 6")
|
||||
|
|
Загрузка…
Ссылка в новой задаче