ruby-changes:65168
From: aycabta <ko1@a...>
Date: Sun, 7 Feb 2021 05:16:55 +0900 (JST)
Subject: [ruby-changes:65168] 03523fdafb (master): [ruby/reline] Scroll down when ^C is pressed
https://git.ruby-lang.org/ruby.git/commit/?id=03523fdafb From 03523fdafb320d53cc455065a25079a9e3a93707 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 29 Jan 2021 18:27:54 +0900 Subject: [ruby/reline] Scroll down when ^C is pressed https://github.com/ruby/reline/commit/6877a7e3f5 --- lib/reline/line_editor.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 4a63503..1017dc6 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -150,6 +150,13 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L150 @screen_height = @screen_size.first reset_variables(prompt, encoding: encoding) @old_trap = Signal.trap('SIGINT') { + if @scroll_partial_screen + move_cursor_down(@screen_height - (@line_index - @scroll_partial_screen) - 1) + else + move_cursor_down(@highest_in_all - @line_index - 1) + end + Reline::IOGate.move_cursor_column(0) + scroll_down(1) @old_trap.call if @old_trap.respond_to?(:call) # can also be string, ex: "DEFAULT" raise Interrupt } @@ -420,6 +427,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L427 end end @buffer_of_lines[@line_index] = @line + @rest_height = 0 if @scroll_partial_screen else line = modify_lines(whole_lines)[@line_index] render_partial(prompt, prompt_width, line, 0) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/