vim-patch:8.2.0911: crash when opening a buffer for the cmdline window fails

Problem:    Crash when opening a buffer for the cmdline window fails. (Chris
            Barber)
Solution:   Check do_ecmd() succeeds.  Reset got_int if "q" was used at the
            more prompt. (closes vim/vim#6211)
9b7cce28d5

Make code match latest Vim instead.
This commit is contained in:
zeertzjq
2022-08-25 19:35:17 +08:00
parent 99f8d34c8a
commit 4ecea0e001
4 changed files with 126 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local feed = helpers.feed
local feed_command = helpers.feed_command
local exec = helpers.exec
@@ -141,3 +142,81 @@ describe('cmdline', function()
]])
end)
end)
describe('cmdwin', function()
before_each(clear)
-- oldtest: Test_cmdwin_interrupted()
it('still uses a new buffer when interrupting more prompt on open', function()
local screen = Screen.new(30, 16)
screen:set_default_attr_ids({
[0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
[1] = {bold = true, reverse = true}, -- StatusLine
[2] = {reverse = true}, -- StatusLineNC
[3] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
[4] = {bold = true}, -- ModeMsg
})
screen:attach()
command('set more')
command('autocmd WinNew * highlight')
feed('q:')
screen:expect({any = '{3:%-%- More %-%-}^'})
feed('q')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:[No Name] }|
{0::}^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{1:[Command Line] }|
|
]])
feed([[aecho 'done']])
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:[No Name] }|
{0::}echo 'done'^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{1:[Command Line] }|
{4:-- INSERT --} |
]])
feed('<CR>')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
done |
]])
end)
end)