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

Handle SIGINT in other thread correctly

Co-authored-by: Koichi Sasada <ko1@atdot.net>
This commit is contained in:
aycabta 2021-08-01 17:41:55 +09:00
parent 5bb7b57129
commit de93b8b069
Notes: git 2021-08-04 18:30:14 +09:00

View file

@ -158,8 +158,16 @@ class Reline::LineEditor
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
case @old_trap
when 'DEFAULT', 'SYSTEM_DEFAULT'
raise Interrupt
when 'IGNORE'
# Do nothing
when 'EXIT'
exit
else
@old_trap.call
end
}
Reline::IOGate.set_winch_handler do
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y