diff options
author | Marco Hinz <mh.codebro+github@gmail.com> | 2018-07-12 14:57:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-12 14:57:20 +0200 |
commit | 01570f1ff3c402af9a9a48c2cca2c5a830c08315 (patch) | |
tree | 370b8669a5fa0eac094766816db9d6bb6f3493a1 /src/nvim/buffer.c | |
parent | 56065bbdc6d20feb431fe55d8165f78fb50eb8b7 (diff) | |
download | rneovim-01570f1ff3c402af9a9a48c2cca2c5a830c08315.tar.gz rneovim-01570f1ff3c402af9a9a48c2cca2c5a830c08315.tar.bz2 rneovim-01570f1ff3c402af9a9a48c2cca2c5a830c08315.zip |
terminal: handle &confirm and :confirm on unloading (#8726)
Show a proper confirmation dialog when trying to unload a terminal buffer while
the confirm option is set or when :confirm is used.
Fixes https://github.com/neovim/neovim/issues/4651
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 95eaf4dcf6..81bbc56eb9 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1172,14 +1172,21 @@ do_buffer ( } } else { if (buf->terminal) { - EMSG2(_("E89: %s will be killed(add ! to override)"), - (char *)buf->b_fname); + if (p_confirm || cmdmod.confirm) { + if (!dialog_close_terminal(buf)) { + return FAIL; + } + } else { + EMSG2(_("E89: %s will be killed(add ! to override)"), + (char *)buf->b_fname); + return FAIL; + } } else { EMSGN(_("E89: No write since last change for buffer %" PRId64 " (add ! to override)"), buf->b_fnum); + return FAIL; } - return FAIL; } } |