diff options
author | aycabta <aycabta@gmail.com> | 2019-05-27 07:35:35 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-27 07:35:35 +0900 |
commit | 2805c55aa39bf6127e1e684deb0d5a0291cb6479 (patch) | |
tree | 3bd0b501fd986254cbb9f3944dbe7bafcbc50924 /lib | |
parent | c49796c9301845e17bd2d5b254ce75d40c898d56 (diff) |
Move to next of last line by ^C
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 2 | ||||
-rw-r--r-- | lib/reline/line_editor.rb | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 2077087f5d..aef750813e 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -347,10 +347,12 @@ module Reline end Reline::IOGate.move_cursor_column(0) rescue StandardError => e + @@line_editor.finalize Reline::IOGate.deprep(otio) raise e end + @@line_editor.finalize Reline::IOGate.deprep(otio) end diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index a47fccf005..7c9eb065b5 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -93,6 +93,15 @@ class Reline::LineEditor @rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y @screen_size = Reline::IOGate.get_screen_size reset_variables(prompt, encoding) + @old_trap = Signal.trap('SIGINT') { + scroll_down(@highest_in_all - @first_line_started_from) + Reline::IOGate.move_cursor_column(0) + @old_trap.() + } + end + + def finalize + Signal.trap('SIGINT', @old_trap) end def reset_variables(prompt = '', encoding = Encoding.default_external) |