diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-25 22:02:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 22:02:29 +0800 |
commit | 22f920030214c0023525c59daf763441baddba1a (patch) | |
tree | 612a7d55cc051dd654a883512373fc3e2c20bdee /src/nvim/ex_getln.c | |
parent | 99f8d34c8a7128a9adb43168ca5364ccbd568333 (diff) | |
parent | 22536eb527e4e42ce5dfbf562678ebd060ae6988 (diff) | |
download | rneovim-22f920030214c0023525c59daf763441baddba1a.tar.gz rneovim-22f920030214c0023525c59daf763441baddba1a.tar.bz2 rneovim-22f920030214c0023525c59daf763441baddba1a.zip |
Merge pull request #19945 from zeertzjq/vim-8.2.0911
vim-patch:8.2.{0911,0923}: cmdwin interrupted
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index afec21a86f..ce4930d33e 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4073,17 +4073,27 @@ static int open_cmdwin(void) ga_clear(&winsizes); return K_IGNORE; } + // Don't let quitting the More prompt make this fail. + got_int = false; + + // Set "cmdwin_type" before any autocommands may mess things up. cmdwin_type = get_cmdline_type(); cmdwin_level = ccline.level; // Create empty command-line buffer. - buf_open_scratch(0, _("[Command Line]")); + if (buf_open_scratch(0, _("[Command Line]")) == FAIL) { + // Some autocommand messed it up? + win_close(curwin, true, false); + ga_clear(&winsizes); + cmdwin_type = 0; + return Ctrl_C; + } // Command-line buffer has bufhidden=wipe, unlike a true "scratch" buffer. set_option_value_give_err("bh", 0L, "wipe", OPT_LOCAL); - curwin->w_p_rl = cmdmsg_rl; - cmdmsg_rl = false; curbuf->b_p_ma = true; curwin->w_p_fen = false; + curwin->w_p_rl = cmdmsg_rl; + cmdmsg_rl = false; // Don't allow switching to another buffer. curbuf->b_ro_locked++; |