aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-19 11:04:01 +0800
committerGitHub <noreply@github.com>2024-01-19 11:04:01 +0800
commitba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7 (patch)
tree05595c1b509f1678ab2ed0670739ce3663fb559b /src
parent78b000c74d631fb097bc2ada0c929153f96d9769 (diff)
downloadrneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.tar.gz
rneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.tar.bz2
rneovim-ba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7.zip
fix(inccommand): improve preview buffer number handling (#27087)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index d10214b48f..2c5c291216 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2277,6 +2277,7 @@ static buf_T *cmdpreview_open_buf(void)
///
/// @return Pointer to command preview window if succeeded, NULL if failed.
static win_T *cmdpreview_open_win(buf_T *cmdpreview_buf)
+ FUNC_ATTR_NONNULL_ALL
{
win_T *save_curwin = curwin;
@@ -2548,10 +2549,10 @@ static bool cmdpreview_may_show(CommandLineState *s)
cmdpreview_prepare(&cpinfo);
// Open preview buffer if inccommand=split.
- if (!icm_split) {
- cmdpreview_bufnr = 0;
- } else if ((cmdpreview_buf = cmdpreview_open_buf()) == NULL) {
- abort();
+ if (icm_split && (cmdpreview_buf = cmdpreview_open_buf()) == NULL) {
+ // Failed to create preview buffer, so disable preview.
+ set_string_option_direct(kOptInccommand, "nosplit", 0, SID_NONE);
+ icm_split = false;
}
// Setup preview namespace if it's not already set.
if (!cmdpreview_ns) {