Thursday, June 7, 2012

Re: Tab Order

On Thursday, June 7, 2012 9:09:16 AM UTC-5, Karthick wrote:
> I tried doing this and ran into an issue..
>
> The script:
> au TabEnter * call TabEnterFunc()
> au TabLeave * call TabLeaveFunc()
>
> func! TabEnterFunc()
> echo 'Enter: ' . tabpagenr("$")
> sleep 1
> endfunc
>
> func! TabLeaveFunc()
> echo 'Leave: ' . tabpagenr("$")
> sleep 1
> endfunction
>
> If a new tab is created with:
> :tabnew
> the prints are,
> Leave: 1
> Enter: 2
> (i.e, the number of tabs on TabEnter is one more than when TabLeave
> triggered). This is good.
>
> But when we quit a tab with :q, we get,
> Leave: 2
> Enter: 2
>
> Shouldn't the number of buffers as returned by tabpagenr("$") be
> up-to-date by the time TabEnter gets triggered?
>
> :version
> VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 9 2008 18:46:22)
> MS-Windows 32-bit GUI version with OLE support
> Compiled by Bram@KIBAALE
> Big version with GUI.

That is weird, not what I'd expect at all. I've duplicated in:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 6 2012 07:36:47)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-540
Compiled by digitectNO@SPAMdancingpaper.com
Huge version with GUI.

The BufEnter event is also too early.

I wonder if the new QuitPre autocmd event introduced in 7.3.544 would allow this to work. I'm not 100% sure you could reliably detect a :tabclose event though using it (maybe I'll try later at home where I compile my own Vim).

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: