mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	test(inccommand): add a test for #20248
This commit is contained in:
		@@ -436,7 +436,7 @@ describe("'inccommand' for user commands", function()
 | 
				
			|||||||
    assert_alive()
 | 
					    assert_alive()
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it("no crash if preview callback executes undo", function()
 | 
					  it('no crash if preview callback executes undo #20036', function()
 | 
				
			||||||
    command('set inccommand=nosplit')
 | 
					    command('set inccommand=nosplit')
 | 
				
			||||||
    exec_lua([[
 | 
					    exec_lua([[
 | 
				
			||||||
      vim.api.nvim_create_user_command('Foo', function() end, {
 | 
					      vim.api.nvim_create_user_command('Foo', function() end, {
 | 
				
			||||||
@@ -457,6 +457,60 @@ describe("'inccommand' for user commands", function()
 | 
				
			|||||||
    feed('<Esc>:Fo')
 | 
					    feed('<Esc>:Fo')
 | 
				
			||||||
    assert_alive()
 | 
					    assert_alive()
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('breaking undo chain in Insert mode works properly #20248', function()
 | 
				
			||||||
 | 
					    command('set inccommand=nosplit')
 | 
				
			||||||
 | 
					    command('inoremap . .<C-G>u')
 | 
				
			||||||
 | 
					    exec_lua([[
 | 
				
			||||||
 | 
					      vim.api.nvim_create_user_command('Test', function() end, {
 | 
				
			||||||
 | 
					        nargs = 1,
 | 
				
			||||||
 | 
					        preview = function(opts, _, _)
 | 
				
			||||||
 | 
					          vim.cmd('norm i' .. opts.args)
 | 
				
			||||||
 | 
					          return 1
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    ]])
 | 
				
			||||||
 | 
					    feed(':Test a.a.a.a.')
 | 
				
			||||||
 | 
					    screen:expect([[
 | 
				
			||||||
 | 
					        text on line 1                        |
 | 
				
			||||||
 | 
					        more text on line 2                   |
 | 
				
			||||||
 | 
					        oh no, even more text                 |
 | 
				
			||||||
 | 
					        will the text ever stop               |
 | 
				
			||||||
 | 
					        oh well                               |
 | 
				
			||||||
 | 
					        did the text stop                     |
 | 
				
			||||||
 | 
					        why won't it stop                     |
 | 
				
			||||||
 | 
					        make the text stop                    |
 | 
				
			||||||
 | 
					      a.a.a.a.                                |
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      :Test a.a.a.a.^                          |
 | 
				
			||||||
 | 
					    ]])
 | 
				
			||||||
 | 
					    feed('<Esc>')
 | 
				
			||||||
 | 
					    screen:expect([[
 | 
				
			||||||
 | 
					        text on line 1                        |
 | 
				
			||||||
 | 
					        more text on line 2                   |
 | 
				
			||||||
 | 
					        oh no, even more text                 |
 | 
				
			||||||
 | 
					        will the text ever stop               |
 | 
				
			||||||
 | 
					        oh well                               |
 | 
				
			||||||
 | 
					        did the text stop                     |
 | 
				
			||||||
 | 
					        why won't it stop                     |
 | 
				
			||||||
 | 
					        make the text stop                    |
 | 
				
			||||||
 | 
					      ^                                        |
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					      {2:~                                       }|
 | 
				
			||||||
 | 
					                                              |
 | 
				
			||||||
 | 
					    ]])
 | 
				
			||||||
 | 
					  end)
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe("'inccommand' with multiple buffers", function()
 | 
					describe("'inccommand' with multiple buffers", function()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user