Christian Brabandt wrote:
> On Do, 07 Jun 2012, Ben Fritz wrote:
>
> > 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.
>
> Bram,
> the problem is, that enter_tabpage() is called when still both tabpages
> are valid (before freeing that tabpage), so tabpagenr() returns the
> wrong number in case of the :tabclose command.
>
> Attached is a patch, that fixes it.
Thanks, I'll check it out.
--
"So this is it," said Arthur, "we are going to die."
"Yes," said Ford, "except...no! Wait a minute!" He suddenly lunged across
the chamber at something behind Arthur's line of vision. "What's this
switch?" he cried.
"What? Where?" cried Arthur, twisting around.
"No, I was only fooling," said Ford, "we are going to die after all."
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- 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 ///
--
You received this message from the "vim_dev" 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