Hi Bram, 2016-10-8(Sat) 23:44:20 UTC+9 Bram Moolenaar: > Hirohito Higashi wrote: > > > How to reproduce: > > - Prepare the following script file > > $ cat sample.vim > > > > e aa.txt > > augroup sample > > autocmd! > > autocmd BufNew * tabedit cc.txt > > Hmm, starting to edit another file in a BufNew autocmd event is just > asking for trouble. In general this should not be allowed. The only > reason it's not an error is to allow for using a temp buffer to do some > work. Okay.
> > > augroup END > > > > normal! i1 > > tabedit bb.txt > > > > - Run vanilla Vim with above script file > > $ vim -Nu NONE -S sample.vim > > > > Expected behavior (I think): > > - Three tabpages is opened. > > 1st: aa.txt (modified) > > 2nd: bb.txt (not modified) <-- current tabpage > > 3rd: cc.txt (not modified) > > > > Actual behavior: > > - Three tabpages is opened. > > 1st: aa.txt (modified) > > 2nd: aa.txt (modified) > > 3rd: cc.txt (not modified) <-- current tabpage > > > > > > I wrote a patch and test. > > Check it please. > > > > NOTE 1: This issue was reported by Norio Takagi. > > NOTE 2: The following part of the patch is a change not related to the main > > topic :-) > > --- a/src/buffer.c > > +++ b/src/buffer.c > > @@ -451,7 +451,7 @@ close_buffer( > > int nwindows; > > bufref_T bufref; > > # ifdef FEAT_WINDOWS > > - int is_curwin = (curwin!= NULL && curwin->w_buffer == buf); > > + int is_curwin = (curwin != NULL && curwin->w_buffer == buf); > > win_T *the_curwin = curwin; > > tabpage_T *the_curtab = curtab; > > # endif > > @@ -1649,10 +1649,11 @@ set_curbuf(buf_T *buf, int action) > > #ifdef FEAT_AUTOCMD > > if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) > > # ifdef FEAT_EVAL > > - || (bufref_valid(&bufref) && !aborting())) > > + || (bufref_valid(&bufref) && !aborting()) > > # else > > - || bufref_valid(&bufref)) > > + || bufref_valid(&bufref) > > # endif > > + ) > > #endif > > { > > #ifdef FEAT_SYN_HL > > I don't think we should even try fixing this. I suspect there will be > other problems. Since this was modified in passing, I do not compulsion. But, I will ensure that the problem does not occur. -- Best regards, Hirohito Higashi (a.k.a. h_east) -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.