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

The stdlib readline should raise Interrupt when pressing C-c

This commit is contained in:
aycabta 2019-09-14 00:16:08 +09:00
parent 70fe473c7d
commit 98f919ed47

View file

@ -65,9 +65,8 @@ class Reline::LineEditor
@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.call if @old_trap.respond_to?(:call) # can also be string, ex: "DEFAULT"
raise Interrupt
}
Reline::IOGate.set_winch_handler do
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y