1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move to next of last line by ^C

This commit is contained in:
aycabta 2019-05-27 07:35:35 +09:00
parent c49796c930
commit 2805c55aa3
2 changed files with 11 additions and 0 deletions

View file

@ -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

View file

@ -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)