diff options
author | aycabta <aycabta@gmail.com> | 2021-09-07 01:44:21 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-09-07 01:59:05 +0900 |
commit | e8ad881336974d1719359d7545b6b9a0efe0dc79 (patch) | |
tree | db0c88967c8b61170be4fc00f15e3737b837ef35 /lib | |
parent | 966ed206a626ef19a5e4deaf77a6ee2a28453026 (diff) | |
download | ruby-e8ad881336974d1719359d7545b6b9a0efe0dc79.tar.gz |
[ruby/reline] Trap TSTP to handle C-z
https://github.com/ruby/reline/commit/ebbd0076b8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 8a23cc0dac..a2ad758081 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -170,6 +170,10 @@ class Reline::LineEditor @old_trap.call end } + @old_tstp_trap = Signal.trap(:TSTP) { + Reline::IOGate.ungetc("\C-z".ord) + @old_tstp_trap.call if @old_tstp_trap.respond_to?(:call) + } Reline::IOGate.set_winch_handler do @rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y old_screen_size = @screen_size @@ -211,6 +215,7 @@ class Reline::LineEditor def finalize Signal.trap('SIGINT', @old_trap) + Signal.trap('SIGTSTP', @old_tstp_trap) end def eof? |