mirror of
https://github.com/neovim/neovim.git
synced 2025-12-20 21:35:38 +00:00
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:
@@ -4184,9 +4184,13 @@ void wipe_buffer(buf_T *buf, bool aucmd)
|
||||
/// @param bufnr Buffer to switch to, or 0 to create a new buffer.
|
||||
///
|
||||
/// @see curbufIsChanged()
|
||||
void buf_open_scratch(handle_T bufnr, char *bufname)
|
||||
///
|
||||
/// @return FAIL for failure, OK otherwise
|
||||
int buf_open_scratch(handle_T bufnr, char *bufname)
|
||||
{
|
||||
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
|
||||
if (do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf);
|
||||
(void)setfname(curbuf, bufname, NULL, true);
|
||||
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf);
|
||||
@@ -4194,4 +4198,5 @@ void buf_open_scratch(handle_T bufnr, char *bufname)
|
||||
set_option_value_give_err("bt", 0L, "nofile", OPT_LOCAL);
|
||||
set_option_value_give_err("swf", 0L, NULL, OPT_LOCAL);
|
||||
RESET_BINDING(curwin);
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user