mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	test(tui_spec): don't use nested terminal for resize at startup (#21583)
This commit is contained in:
		@@ -13,6 +13,7 @@ local feed_command = helpers.feed_command
 | 
			
		||||
local feed_data = thelpers.feed_data
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local command = helpers.command
 | 
			
		||||
local exec = helpers.exec
 | 
			
		||||
local testprg = helpers.testprg
 | 
			
		||||
local retry = helpers.retry
 | 
			
		||||
local nvim_prog = helpers.nvim_prog
 | 
			
		||||
@@ -90,24 +91,6 @@ describe('TUI', function()
 | 
			
		||||
    assert_alive()
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('resize at startup', function()
 | 
			
		||||
    -- Issues: #17285 #15044 #11330
 | 
			
		||||
    screen:try_resize(50, 10)
 | 
			
		||||
    feed_command([[call termopen([v:progpath, '--clean', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile']) | sleep 500m | vs new]])
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
      {1: }                        │                        |
 | 
			
		||||
      {4:~                        }│{4:~                       }|
 | 
			
		||||
      {4:~                        }│{4:~                       }|
 | 
			
		||||
      {4:~                        }│{4:~                       }|
 | 
			
		||||
      {4:~                        }│{4:~                       }|
 | 
			
		||||
      {4:~                        }│{5:[No Name]   0,0-1    All}|
 | 
			
		||||
      {4:~                        }│                        |
 | 
			
		||||
      {5:new                       }{MATCH:<.*[/\]nvim }|
 | 
			
		||||
                                                        |
 | 
			
		||||
      {3:-- TERMINAL --}                                    |
 | 
			
		||||
    ]])
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('accepts resize while pager is active', function()
 | 
			
		||||
    child_session:request("nvim_command", [[
 | 
			
		||||
    set more
 | 
			
		||||
@@ -1437,6 +1420,35 @@ describe('TUI', function()
 | 
			
		||||
    os.remove('testF')
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('resize at startup #17285 #15044 #11330', function()
 | 
			
		||||
    local screen = Screen.new(50, 10)
 | 
			
		||||
    screen:set_default_attr_ids({
 | 
			
		||||
      [1] = {reverse = true},
 | 
			
		||||
      [2] = {bold = true, foreground = Screen.colors.Blue},
 | 
			
		||||
      [3] = {bold = true},
 | 
			
		||||
      [4] = {foreground = tonumber('0x4040ff'), fg_indexed = true},
 | 
			
		||||
      [5] = {bold = true, reverse = true},
 | 
			
		||||
    })
 | 
			
		||||
    screen:attach()
 | 
			
		||||
    exec([[
 | 
			
		||||
      call termopen([v:progpath, '--clean', '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile'])
 | 
			
		||||
      sleep 500m
 | 
			
		||||
      vs new
 | 
			
		||||
    ]])
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
      ^                         │                        |
 | 
			
		||||
      {2:~                        }│{4:~                       }|
 | 
			
		||||
      {2:~                        }│{4:~                       }|
 | 
			
		||||
      {2:~                        }│{4:~                       }|
 | 
			
		||||
      {2:~                        }│{4:~                       }|
 | 
			
		||||
      {2:~                        }│{4:~                       }|
 | 
			
		||||
      {2:~                        }│{5:[No Name]   0,0-1    All}|
 | 
			
		||||
      {2:~                        }│                        |
 | 
			
		||||
      {5:new                       }{MATCH:<.*[/\]nvim }|
 | 
			
		||||
                                                        |
 | 
			
		||||
    ]])
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('with non-tty (pipe) stdout/stderr', function()
 | 
			
		||||
    local screen = thelpers.screen_setup(0, '"'..nvim_prog
 | 
			
		||||
      ..' -u NONE -i NONE --cmd \'set noswapfile noshowcmd noruler\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user