diff options
author | tomoya ishida <[email protected]> | 2024-12-01 02:21:17 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-11-30 17:21:20 +0000 |
commit | 0fc70022e694da2c8c6ee5dbde2de24b2a389d93 (patch) | |
tree | d60222303cd21cf0bce75b9eb1a2eaf7f695f04a /lib | |
parent | 569f27b4259f0d11e0291f28528a5c9de1249a44 (diff) |
[ruby/reline] Call user defined sigwinch and sigcont handler
(https://github.com/ruby/reline/pull/788)
https://github.com/ruby/reline/commit/7d44770c84
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/io/ansi.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/reline/io/ansi.rb b/lib/reline/io/ansi.rb index c51e97b722..b351952a82 100644 --- a/lib/reline/io/ansi.rb +++ b/lib/reline/io/ansi.rb @@ -284,11 +284,15 @@ class Reline::ANSI < Reline::IO end def set_winch_handler(&handler) - @old_winch_handler = Signal.trap('WINCH', &handler) - @old_cont_handler = Signal.trap('CONT') do + @old_winch_handler = Signal.trap('WINCH') do |arg| + handler.call + @old_winch_handler.call(arg) if @old_winch_handler.respond_to?(:call) + end + @old_cont_handler = Signal.trap('CONT') do |arg| @input.raw!(intr: true) if @input.tty? # Rerender the screen. Note that screen size might be changed while suspended. handler.call + @old_cont_handler.call(arg) if @old_cont_handler.respond_to?(:call) end rescue ArgumentError # Signal.trap may raise an ArgumentError if the platform doesn't support the signal. |