fix(secure): crash when hitting escape in prompt (#21283)

- use pcall when calling vim.secure.read from C
- catch keyboard interrupts in vim.secure.read, rethrow other errors
- selecting "view" in prompt runs :view command
- simplify lua stack cleanup with lua_gettop and lua_settop

Co-authored-by: ii14 <ii14@users.noreply.github.com>
This commit is contained in:
ii14
2022-12-05 19:59:04 +01:00
committed by GitHub
parent 707df88054
commit f3bf1fbf60
3 changed files with 24 additions and 26 deletions

View File

@@ -150,10 +150,10 @@ describe('vim.secure', function()
]]}
feed('v')
screen:expect{grid=[[
^ let g:foobar = 42 |
^let g:foobar = 42 |
{1:~ }|
{1:~ }|
{2:]] .. cwd .. pathsep .. [[Xfile [RO]{MATCH:%s+}|
{2:]] .. funcs.fnamemodify(cwd, ':~') .. pathsep .. [[Xfile [RO]{MATCH:%s+}|
|
{1:~ }|
{4:[No Name] }|
@@ -166,7 +166,7 @@ describe('vim.secure', function()
-- Cannot write file
pcall_err(command, 'write')
eq(false, curbufmeths.get_option('modifiable'))
eq(true, curbufmeths.get_option('readonly'))
end)
end)