mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	fix(edit): don't go to Terminal mode when stopping Insert mode (#27033)
This commit is contained in:
		@@ -402,7 +402,7 @@ static int insert_check(VimState *state)
 | 
				
			|||||||
    Insstart_orig = Insstart;
 | 
					    Insstart_orig = Insstart;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (curbuf->terminal) {
 | 
					  if (curbuf->terminal && !stop_insert_mode) {
 | 
				
			||||||
    // Exit Insert mode and go to Terminal mode.
 | 
					    // Exit Insert mode and go to Terminal mode.
 | 
				
			||||||
    stop_insert_mode = true;
 | 
					    stop_insert_mode = true;
 | 
				
			||||||
    restart_edit = 'I';
 | 
					    restart_edit = 'I';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,6 +144,15 @@ describe(':terminal', function()
 | 
				
			|||||||
    eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
 | 
					    eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
 | 
				
			||||||
    eq({ 'InsertLeave', 'TermEnter' }, eval('g:events'))
 | 
					    eq({ 'InsertLeave', 'TermEnter' }, eval('g:events'))
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('switching to terminal buffer immediately after :stopinsert #27031', function()
 | 
				
			||||||
 | 
					    command('terminal')
 | 
				
			||||||
 | 
					    command('vnew')
 | 
				
			||||||
 | 
					    feed('i')
 | 
				
			||||||
 | 
					    eq({ blocking = false, mode = 'i' }, api.nvim_get_mode())
 | 
				
			||||||
 | 
					    command('stopinsert | wincmd p')
 | 
				
			||||||
 | 
					    eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
 | 
				
			||||||
 | 
					  end)
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function test_terminal_with_fake_shell(backslash)
 | 
					local function test_terminal_with_fake_shell(backslash)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user