Merge pull request #16421 from seandewar/vim-8.1.0035

vim-patch:8.1.{35,42,64},8.2.{1781,1783,1976,2014,3671}
This commit is contained in:
Jan Edmund Lazo
2021-12-07 21:17:12 -05:00
committed by GitHub
8 changed files with 267 additions and 22 deletions

View File

@@ -1,9 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local feed= helpers.feed
local feed = helpers.feed
local source = helpers.source
local clear = helpers.clear
local feed_command = helpers.feed_command
local poke_eventloop = helpers.poke_eventloop
local meths = helpers.meths
local eq = helpers.eq
describe('prompt buffer', function()
local screen
@@ -28,12 +31,17 @@ describe('prompt buffer', function()
func TimerFunc(text)
call append(line("$") - 1, 'Result: "' . a:text .'"')
endfunc
func SwitchWindows()
call timer_start(0, {-> execute("wincmd p|wincmd p", "")})
endfunc
]])
feed_command("set noshowmode | set laststatus=0")
feed_command("call setline(1, 'other buffer')")
feed_command("new")
feed_command("set buftype=prompt")
feed_command("call prompt_setcallback(bufnr(''), function('TextEntered'))")
feed_command("eval bufnr('')->prompt_setprompt('cmd: ')")
end)
after_each(function()
@@ -56,10 +64,10 @@ describe('prompt buffer', function()
feed("i")
feed("hello\n")
screen:expect([[
% hello |
cmd: hello |
Command: "hello" |
Result: "hello" |
% ^ |
cmd: ^ |
[Prompt] [+] |
other buffer |
~ |
@@ -98,7 +106,7 @@ describe('prompt buffer', function()
feed("i")
feed("hello<BS><BS>")
screen:expect([[
% hel^ |
cmd: hel^ |
~ |
~ |
~ |
@@ -111,7 +119,20 @@ describe('prompt buffer', function()
]])
feed("<Left><Left><Left><BS>-")
screen:expect([[
% -^hel |
cmd: -^hel |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
feed("<C-O>lz")
screen:expect([[
cmd: -hz^el |
~ |
~ |
~ |
@@ -124,7 +145,7 @@ describe('prompt buffer', function()
]])
feed("<End>x")
screen:expect([[
% -helx^ |
cmd: -hzelx^ |
~ |
~ |
~ |
@@ -150,4 +171,58 @@ describe('prompt buffer', function()
]])
end)
it('switch windows', function()
feed_command("set showmode")
feed("i")
screen:expect([[
cmd: ^ |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
-- INSERT -- |
]])
feed("<C-O>:call SwitchWindows()<CR>")
poke_eventloop()
screen:expect([[
cmd: ^ |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
-- INSERT -- |
]])
feed("<Esc>")
poke_eventloop()
screen:expect([[
cmd:^ |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
end)
it('keeps insert mode after aucmd_restbuf in callback', function()
source [[
let s:buf = nvim_create_buf(1, 1)
call timer_start(0, {-> nvim_buf_set_lines(s:buf, -1, -1, 0, ['walrus'])})
startinsert
]]
poke_eventloop()
eq({ mode = "i", blocking = false }, meths.get_mode())
end)
end)