File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
test/reline/yamatanooroti Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,13 @@ def clear_screen
347347
348348 def set_winch_handler ( &handler )
349349 @old_winch_handler = Signal . trap ( 'WINCH' , &handler )
350+ @old_cont_handler = Signal . trap ( 'CONT' ) do
351+ @input . raw! ( intr : true ) if @input . tty?
352+ # Rerender the screen. Note that screen size might be changed while suspended.
353+ handler . call
354+ end
355+ rescue ArgumentError
356+ # Signal.trap may raise an ArgumentError if the platform doesn't support the signal.
350357 end
351358
352359 def prep
@@ -360,5 +367,6 @@ def deprep(otio)
360367 # Disable bracketed paste
361368 @output . write "\e [?2004l" if Reline . core . config . enable_bracketed_paste && both_tty?
362369 Signal . trap ( 'WINCH' , @old_winch_handler ) if @old_winch_handler
370+ Signal . trap ( 'CONT' , @old_cont_handler ) if @old_cont_handler
363371 end
364372end
Original file line number Diff line number Diff line change @@ -1840,6 +1840,25 @@ def test_thread_safe
18401840 EOC
18411841 end
18421842
1843+ def test_stop_continue
1844+ pidfile = Tempfile . create ( 'pidfile' )
1845+ rubyfile = Tempfile . create ( 'rubyfile' )
1846+ rubyfile . write <<~RUBY
1847+ File.write(#{ pidfile . path . inspect } , Process.pid)
1848+ p Reline.readmultiline('>'){false}
1849+ RUBY
1850+ rubyfile . close
1851+ start_terminal ( 40 , 50 , [ 'bash' ] )
1852+ write "ruby -I#{ @pwd } /lib -rreline #{ rubyfile . path } \n "
1853+ write "abc\n def\n hi"
1854+ pid = pidfile . tap ( &:rewind ) . read . to_i
1855+ Process . kill ( :STOP , pid ) unless pid . zero?
1856+ write "fg\n "
1857+ write "\e bg"
1858+ close
1859+ assert_include result . join ( "\n " ) , ">abc\n >def\n >ghi\n "
1860+ end
1861+
18431862 def write_inputrc ( content )
18441863 File . open ( @inputrc_file , 'w' ) do |f |
18451864 f . write content
You can’t perform that action at this time.
0 commit comments