aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-21 11:02:29 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-03-22 18:42:58 +0100
commit53ccd07fa1c0bfcb79ca11bd873ea12f4dc12f4a (patch)
tree12280d1ac92ac758aa3be2cdff38a81fe2dc1721 /src
parentb0e34497b357462024c07d506a16426d58475497 (diff)
downloadrneovim-53ccd07fa1c0bfcb79ca11bd873ea12f4dc12f4a.tar.gz
rneovim-53ccd07fa1c0bfcb79ca11bd873ea12f4dc12f4a.tar.bz2
rneovim-53ccd07fa1c0bfcb79ca11bd873ea12f4dc12f4a.zip
lint
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c4
-rw-r--r--src/nvim/ex_docmd.c18
-rw-r--r--src/nvim/window.c5
3 files changed, 15 insertions, 12 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 7429e8628e..3c416c157f 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -4518,8 +4518,8 @@ void ex_buffer_all(exarg_T *eap)
? wp->w_height + wp->w_status_height < Rows - p_ch
- tabline_height()
: wp->w_width != Columns)
- || (had_tab > 0 && wp != firstwin)
- ) && firstwin != lastwin
+ || (had_tab > 0 && wp != firstwin))
+ && firstwin != lastwin
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)
) {
win_close(wp, FALSE);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ebfbf2bf09..abf4371455 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5833,11 +5833,12 @@ static void ex_quit_all(exarg_T *eap)
text_locked_msg();
return;
}
- apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
- /* Refuse to quit when locked or when the buffer in the last window is
- * being closed (can only happen in autocommands). */
- if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
+ apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, curbuf);
+ // Refuse to quit when locked or when the buffer in the last window is
+ // being closed (can only happen in autocommands).
+ if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) {
return;
+ }
exiting = true;
if (eap->forceit || !check_changed_any(false, false)) {
@@ -6128,11 +6129,12 @@ static void ex_exit(exarg_T *eap)
text_locked_msg();
return;
}
- apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
- /* Refuse to quit when locked or when the buffer in the last window is
- * being closed (can only happen in autocommands). */
- if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
+ apply_autocmds(EVENT_QUITPRE, NULL, NULL, false, curbuf);
+ // Refuse to quit when locked or when the buffer in the last window is
+ // being closed (can only happen in autocommands).
+ if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) {
return;
+ }
// if more files or windows we won't exit
if (check_more(false, eap->forceit) == OK && only_one_window()) {
diff --git a/src/nvim/window.c b/src/nvim/window.c
index a737ffb33c..15482d9061 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1746,7 +1746,7 @@ void close_windows(buf_T *buf, int keep_curwin)
FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
if (wp->w_buffer == buf
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)) {
- win_close_othertab(wp, FALSE, tp);
+ win_close_othertab(wp, false, tp);
/* Start all over, the tab page may be closed and
* autocommands may change the window layout. */
@@ -1881,7 +1881,8 @@ int win_close(win_T *win, int free_buf)
return FAIL;
}
- if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) {
+ if (win->w_closing
+ || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) {
return FAIL; // window is already being closed
}
if (win == aucmd_win) {