Yes, I came to the same conclusion. And i saw that remark in the doc. I
sent a mail to the dbext maintainer with the patch.
Unfortunately this is still not complete fix. As far as there are many
programmatic buffer swaps upon deletion, BufEnter is not triggered
eventually. This makes, for instance, effect of losing extra syntax
highlighting defined in TagHighlight script i use: setting syntax in the
end of patched dbext#DB_auBufDelete() turns on only basic syntax, and
autocmds for BufEnter defined in TagHighlight are not triggered.

Thank you, Alexey.

2011/11/19 Bram Moolenaar <[email protected]>

>
> Alexey Radkov wrote:
>
> > I found a bug in buffer unloading algorithm due to kind of
> > misconception between how close_buffer() treats buffer unloading data
> > (checking first character in b_p_bl[] in passed buffer) and situations
> > when this function can be called. The bug is triggered in rare cases
> > when
> >
> > 1). a user makes ':q' from a latest window in a tabpage which has
> > bufhidden=delete (or :cclose from a normal buffer, see later) and at
> > the same time
> > 2). specific BufDelete autocommands that temporarily load other
> > buffer(s) as curbuf are triggered.
> >
> > This is how to reproduce it:
> >
> > 1). put in .vimrc:
> >
> > set switchbuf=usetab
> > autocmd BufEnter * if empty(&buftype) | setlocal bufhidden=delete |
> > endif
> >
> > this will make all normal buffers marked as bufhidden=delete. I use
> > this for easy navigation between open buffers using arrow keys mapped
> > as
> >
> > nmap <C-left>   :tabp<CR>
> > nmap <C-right>  :tabn<CR>
> > nmap <C-up>     :sbn<CR>
> > nmap <C-down>   :sbp<CR>
> >
> > and bufhidden=delete won't raise up already hidden buffers
> >
> > 2) install dbext plugin. It just has excellent BufDelete autocommand
> > which temporarily swaps curbuf to its own buffer and then return
> > curbuf to previous buffer. Actually dbext made it possible to find
> > this vim's issue.
> >
> > 3) Now open some file, when loaded do
> >
> > :tabnew <other-file>
> >
> > you will be switched to a new tabpage and there do
> >
> > :q
> >
> > You will be returned to the original file, but... Now there is no
> > syntax highlight and ':ls' will show that there is no current buffer!
> > ':ls!' will show that the current buffer is unloaded. Same behaviour
> > can be found when using quickfix window instead tabpage.
>
> [...]
>
> If I read the following messages correctly, the problem can be solved by
> adjusting the autocommands for dbext.
>
> Autocommands are always tricky, especially if one doesn't take care of
> all possible combinations of settings.  Setting 'bufhidden' to "delete"
> is one of these.  There is a CAREFUL remark in the docs for that reason.
>
> So I don't think this is a bug in Vim but a problem in using
> autocommands.
>
> --
> hundred-and-one symptoms of being an internet addict:
> 152. You find yourself falling for someone you've never seen or hardly
>     know, but, boy can he/she TYPE!!!!!!
>
>  /// 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

Raspunde prin e-mail lui