aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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) {