diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-23 02:08:12 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-23 02:21:46 -0500 |
commit | afa5a11363d76f4a51469ed87f3998d854ae56c2 (patch) | |
tree | 2217c9981b215ad8f4939c5a234e0d05fc91b69e /src/nvim/buffer.c | |
parent | d0668b36a3e2d0683059baead45bea27e2358e9c (diff) | |
download | rneovim-afa5a11363d76f4a51469ed87f3998d854ae56c2.tar.gz rneovim-afa5a11363d76f4a51469ed87f3998d854ae56c2.tar.bz2 rneovim-afa5a11363d76f4a51469ed87f3998d854ae56c2.zip |
vim-patch:8.2.0116: BufEnter autocmd not triggered on ":tab drop"
Problem: BufEnter autocmd not triggered on ":tab drop". (Andy Stewart)
Solution: Decrement autocmd_no_enter for the last file. (closes vim/vim#1660,
closes vim/vim#5473)
https://github.com/vim/vim/commit/c10b521628f2b073fa231defa26f23937c91724d
N/A patches for version.c:
vim-patch:8.1.1805: au_did_filetype is declared twice
Problem: Au_did_filetype is declared twice.
Solution: Remove it from autocmd.c. (closes vim/vim#4767)
https://github.com/vim/vim/commit/6cd57d44669c02af9195f5601b882edd435b47e8
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index a5e8097133..f40ebaad90 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4706,7 +4706,6 @@ do_arg_all( int keep_tabs // keep current tabs, for ":tab drop file" ) { - int i; char_u *opened; // Array of weight for which args are open: // 0: not opened // 1: opened in other tab @@ -4715,6 +4714,7 @@ do_arg_all( int opened_len; // length of opened[] int use_firstwin = false; // use first window for arglist + bool tab_drop_empty_window = false; int split_ret = OK; bool p_ea_save; alist_T *alist; // argument list to be used @@ -4762,6 +4762,7 @@ do_arg_all( win_T *wpnext = NULL; tpnext = curtab->tp_next; for (win_T *wp = firstwin; wp != NULL; wp = wpnext) { + int i; wpnext = wp->w_next; buf = wp->w_buffer; if (buf->b_ffname == NULL @@ -4867,14 +4868,15 @@ do_arg_all( last_curwin = curwin; last_curtab = curtab; win_enter(lastwin, false); - // ":drop all" should re-use an empty window to avoid "--remote-tab" + // ":tab drop file" should re-use an empty window to avoid "--remote-tab" // leaving an empty tab page when executed locally. if (keep_tabs && BUFEMPTY() && curbuf->b_nwindows == 1 && curbuf->b_ffname == NULL && !curbuf->b_changed) { use_firstwin = true; + tab_drop_empty_window = true; } - for (i = 0; i < count && i < opened_len && !got_int; i++) { + for (int i = 0; i < count && !got_int; i++) { if (alist == &global_alist && i == global_alist.al_ga.ga_len - 1) { arg_had_last = true; } @@ -4894,6 +4896,10 @@ do_arg_all( } } } else if (split_ret == OK) { + // trigger events for tab drop + if (tab_drop_empty_window && i == count - 1) { + autocmd_no_enter--; + } if (!use_firstwin) { // split current window p_ea_save = p_ea; p_ea = true; // use space from all windows @@ -4919,6 +4925,9 @@ do_arg_all( || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0) + ECMD_OLDBUF, curwin); + if (tab_drop_empty_window && i == count - 1) { + autocmd_no_enter++; + } if (use_firstwin) { autocmd_no_leave++; } |