Patch 7.4.2077

36 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 19, 2016, 5:13:57 PM7/19/16
to vim...@googlegroups.com

Patch 7.4.2077
Problem: Cannot update 'tabline' when a tab was closed.
Solution: Add the TabClosed autocmd event. (partly by Felipe Morales)
Files: src/fileio.c, src/window.c, src/vim.h,
src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt


*** ../vim-7.4.2076/src/fileio.c 2016-07-19 22:31:31.633930347 +0200
--- src/fileio.c 2016-07-19 22:46:26.216709523 +0200
***************
*** 7707,7712 ****
--- 7707,7713 ----
{"SwapExists", EVENT_SWAPEXISTS},
{"Syntax", EVENT_SYNTAX},
{"TabNew", EVENT_TABNEW},
+ {"TabClosed", EVENT_TABCLOSED},
{"TabEnter", EVENT_TABENTER},
{"TabLeave", EVENT_TABLEAVE},
{"TermChanged", EVENT_TERMCHANGED},
*** ../vim-7.4.2076/src/window.c 2016-07-19 22:31:31.637930306 +0200
--- src/window.c 2016-07-19 23:07:50.151399112 +0200
***************
*** 2095,2100 ****
--- 2095,2103 ----
win_T *wp;
tabpage_T *tp, *nexttp;
int h = tabline_height();
+ #ifdef FEAT_AUTOCMD
+ int count = tabpage_index(NULL);
+ #endif

++RedrawingDisabled;

***************
*** 2138,2143 ****
--- 2141,2151 ----

--RedrawingDisabled;

+ #ifdef FEAT_AUTOCMD
+ if (count != tabpage_index(NULL))
+ apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
+ #endif
+
redraw_tabline = TRUE;
if (h != tabline_height())
shell_new_rows();
***************
*** 2220,2225 ****
--- 2228,2234 ----
/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
* that now. */
#ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
if (old_curbuf != curbuf)
*** ../vim-7.4.2076/src/vim.h 2016-07-19 22:31:31.637930306 +0200
--- src/vim.h 2016-07-19 22:46:10.860867655 +0200
***************
*** 1331,1336 ****
--- 1331,1337 ----
EVENT_TABENTER, /* after entering a tab page */
EVENT_TABLEAVE, /* before leaving a tab page */
EVENT_TABNEW, /* when entering a new tab page */
+ EVENT_TABCLOSED, /* after closing a tab page */
EVENT_SHELLCMDPOST, /* after ":!cmd" */
EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */
EVENT_TEXTCHANGED, /* text was modified */
*** ../vim-7.4.2076/src/testdir/test_autocmd.vim 2016-07-19 22:31:31.637930306 +0200
--- src/testdir/test_autocmd.vim 2016-07-19 23:08:53.342742970 +0200
***************
*** 87,92 ****
--- 87,93 ----
au WinEnter * call add(g:record, 'WinEnter')
au WinLeave * call add(g:record, 'WinLeave')
au TabNew * call add(g:record, 'TabNew')
+ au TabClosed * call add(g:record, 'TabClosed')
au TabEnter * call add(g:record, 'TabEnter')
au TabLeave * call add(g:record, 'TabLeave')
augroup END
***************
*** 99,108 ****
call assert_equal([
\ 'WinLeave', 'WinNew', 'WinEnter',
\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',
! \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter',
\ 'WinLeave', 'WinEnter'
\ ], g:record)

augroup testing
au!
augroup END
--- 100,120 ----
call assert_equal([
\ 'WinLeave', 'WinNew', 'WinEnter',
\ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',
! \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter',
\ 'WinLeave', 'WinEnter'
\ ], g:record)

+ let g:record = []
+ tabnew somefile
+ tabnext
+ bwipe somefile
+
+ call assert_equal([
+ \ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',
+ \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter',
+ \ 'TabClosed'
+ \ ], g:record)
+
augroup testing
au!
augroup END
*** ../vim-7.4.2076/runtime/doc/autocmd.txt 2016-07-19 22:31:31.637930306 +0200
--- runtime/doc/autocmd.txt 2016-07-19 22:57:57.925553527 +0200
***************
*** 294,300 ****
|CursorMovedI| the cursor was moved in Insert mode

|WinNew| after creating a new window
! |TabNew| after creating a new window
|WinEnter| after entering another window
|WinLeave| before leaving a window
|TabEnter| after entering another tab page
--- 294,301 ----
|CursorMovedI| the cursor was moved in Insert mode

|WinNew| after creating a new window
! |TabNew| after creating a new tab page
! |TabClosed| after closing a tab page
|WinEnter| after entering another window
|WinLeave| before leaving a window
|TabEnter| after entering another tab page
***************
*** 867,872 ****
--- 877,884 ----
where this option was set, and <amatch> for
the new value of 'syntax'.
See |:syn-on|.
+ *TabClosed*
+ TabClosed After closing a tab page.
*TabEnter*
TabEnter Just after entering a tab page. |tab-page|
After triggering the WinEnter and before
*** ../vim-7.4.2076/src/version.c 2016-07-19 22:43:06.382767764 +0200
--- src/version.c 2016-07-19 23:11:32.069095630 +0200
***************
*** 760,761 ****
--- 760,763 ----
{ /* Add new patch number below this line */
+ /**/
+ 2077,
/**/

--
Individualists unite!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages