mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #18038 from zeertzjq/vim-8.2.4711
vim-patch:8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
This commit is contained in:
commit
56ee7c29ab
@ -2875,7 +2875,7 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
|
|||||||
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
|
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_im) {
|
if (p_im && (State & INSERT) == 0) {
|
||||||
need_start_insertmode = true;
|
need_start_insertmode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1627,6 +1627,29 @@ func Test_edit_is_a_directory()
|
|||||||
call delete(dirname, 'rf')
|
call delete(dirname, 'rf')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Using :edit without leaving 'insertmode' should not cause Insert mode to be
|
||||||
|
" re-entered immediately after <C-L>
|
||||||
|
func Test_edit_insertmode_ex_edit()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set insertmode noruler
|
||||||
|
inoremap <C-B> <Cmd>edit Xfoo<CR>
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xtest_edit_insertmode_ex_edit')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6})
|
||||||
|
call TermWait(buf, 50)
|
||||||
|
call assert_match('^-- INSERT --\s*$', term_getline(buf, 6))
|
||||||
|
call term_sendkeys(buf, "\<C-B>\<C-L>")
|
||||||
|
call TermWait(buf, 50)
|
||||||
|
call assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xtest_edit_insertmode_ex_edit')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_edit_browse()
|
func Test_edit_browse()
|
||||||
" in the GUI this opens a file picker, we only test the terminal behavior
|
" in the GUI this opens a file picker, we only test the terminal behavior
|
||||||
CheckNotGui
|
CheckNotGui
|
||||||
|
@ -6,6 +6,8 @@ local expect = helpers.expect
|
|||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
local meths = helpers.meths
|
||||||
|
local poke_eventloop = helpers.poke_eventloop
|
||||||
|
|
||||||
describe('insert-mode', function()
|
describe('insert-mode', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@ -128,4 +130,26 @@ describe('insert-mode', function()
|
|||||||
expect('<M-1><D-2><M-7><D-8>')
|
expect('<M-1><D-2><M-7><D-8>')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe([[With 'insertmode', Insert mode is not re-entered immediately after <C-L>]], function()
|
||||||
|
before_each(function()
|
||||||
|
command('set insertmode')
|
||||||
|
poke_eventloop()
|
||||||
|
eq({mode = 'i', blocking = false}, meths.get_mode())
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('after calling :edit from <Cmd> mapping', function()
|
||||||
|
command('inoremap <C-B> <Cmd>edit Xfoo<CR>')
|
||||||
|
feed('<C-B><C-L>')
|
||||||
|
poke_eventloop()
|
||||||
|
eq({mode = 'n', blocking = false}, meths.get_mode())
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('after calling :edit from RPC #16823', function()
|
||||||
|
command('edit Xfoo')
|
||||||
|
feed('<C-L>')
|
||||||
|
poke_eventloop()
|
||||||
|
eq({mode = 'n', blocking = false}, meths.get_mode())
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user