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

[ruby/reline] Use String for the value to be passed because Signal.trap also returns String

b908fe4439
This commit is contained in:
aycabta 2021-09-07 02:24:41 +09:00 committed by git
parent 8d9e767f1a
commit f927614e55

View file

@ -150,7 +150,7 @@ class Reline::LineEditor
@screen_size = Reline::IOGate.get_screen_size @screen_size = Reline::IOGate.get_screen_size
@screen_height = @screen_size.first @screen_height = @screen_size.first
reset_variables(prompt, encoding: encoding) reset_variables(prompt, encoding: encoding)
@old_trap = Signal.trap(:INT) { @old_trap = Signal.trap('INT') {
clear_dialog clear_dialog
if @scroll_partial_screen if @scroll_partial_screen
move_cursor_down(@screen_height - (@line_index - @scroll_partial_screen) - 1) move_cursor_down(@screen_height - (@line_index - @scroll_partial_screen) - 1)
@ -171,7 +171,7 @@ class Reline::LineEditor
end end
} }
begin begin
@old_tstp_trap = Signal.trap(:TSTP) { @old_tstp_trap = Signal.trap('TSTP') {
Reline::IOGate.ungetc("\C-z".ord) Reline::IOGate.ungetc("\C-z".ord)
@old_tstp_trap.call if @old_tstp_trap.respond_to?(:call) @old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
} }