diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2024-01-28 13:03:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-28 13:03:56 +0000 |
commit | a757195a602bf502fcdb702887bf72f50d6e1717 (patch) | |
tree | 41f77c24ddfb88b82eaf1c6a5748036276eea2f9 /src/nvim/buffer.c | |
parent | 74e695d22715e52f5561a185583b8c23d4fa0dd6 (diff) | |
parent | d85f180f26c0570c2510c899a0bf0023ec55a692 (diff) | |
download | rneovim-a757195a602bf502fcdb702887bf72f50d6e1717.tar.gz rneovim-a757195a602bf502fcdb702887bf72f50d6e1717.tar.bz2 rneovim-a757195a602bf502fcdb702887bf72f50d6e1717.zip |
Merge pull request #24704 from seandewar/cmdwin-madness
vim-patch:9.1.{0047,0048,0049}: fun cmdwin fixes
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index da1e27aebf..d597d82ee2 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4012,6 +4012,9 @@ char *buf_spname(buf_T *buf) if (buf->b_fname != NULL) { return buf->b_fname; } + if (buf == cmdwin_buf) { + return _("[Command Line]"); + } if (bt_prompt(buf)) { return _("[Prompt]"); } @@ -4129,6 +4132,7 @@ void wipe_buffer(buf_T *buf, bool aucmd) /// - Always considered 'nomodified' /// /// @param bufnr Buffer to switch to, or 0 to create a new buffer. +/// @param bufname Buffer name, or NULL. /// /// @see curbufIsChanged() /// @@ -4138,9 +4142,11 @@ int buf_open_scratch(handle_T bufnr, char *bufname) if (do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL) { return FAIL; } - apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf); - setfname(curbuf, bufname, NULL, true); - apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf); + if (bufname != NULL) { + apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf); + setfname(curbuf, bufname, NULL, true); + apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf); + } set_option_value_give_err(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("hide"), OPT_LOCAL); set_option_value_give_err(kOptBuftype, STATIC_CSTR_AS_OPTVAL("nofile"), OPT_LOCAL); set_option_value_give_err(kOptSwapfile, BOOLEAN_OPTVAL(false), OPT_LOCAL); |