Patch 8.2.2433
Problem:    Opening cmdline window gives error in BufLeave autocommand.
Solution:   Reset cmdwin_type when triggering the autocommand.
Files:      src/ex_cmds.c, src/testdir/test_cmdline.vim


*** ../vim-8.2.2432/src/ex_cmds.c       2021-01-28 20:18:04.800631715 +0100
--- src/ex_cmds.c       2021-01-30 21:35:48.627744039 +0100
***************
*** 2710,2715 ****
--- 2710,2721 ----
         */
        if (buf != curbuf)
        {
+ #ifdef FEAT_CMDWIN
+           int save_cmdwin_type = cmdwin_type;
+ 
+           // BufLeave applies to the old buffer.
+           cmdwin_type = 0;
+ #endif
            /*
             * Be careful: The autocommands may delete any buffer and change
             * the current buffer.
***************
*** 2724,2729 ****
--- 2730,2738 ----
                new_name = vim_strsave(buf->b_fname);
            set_bufref(&au_new_curbuf, buf);
            apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
+ #ifdef FEAT_CMDWIN
+           cmdwin_type = save_cmdwin_type;
+ #endif
            if (!bufref_valid(&au_new_curbuf))
            {
                // new buffer has been deleted
*** ../vim-8.2.2432/src/testdir/test_cmdline.vim        2021-01-26 
22:42:17.694836803 +0100
--- src/testdir/test_cmdline.vim        2021-01-30 21:33:43.116083467 +0100
***************
*** 1237,1242 ****
--- 1237,1243 ----
  
    augroup CmdWin
      au!
+     autocmd BufLeave * if &buftype == '' | update | endif
      autocmd CmdwinEnter * startinsert
    augroup END
  
*** ../vim-8.2.2432/src/version.c       2021-01-30 20:31:57.687115293 +0100
--- src/version.c       2021-01-30 21:34:00.076038093 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2433,
  /**/

-- 
       In war we're tough and able.
       Quite indefatigable
       Between our quests
       We sequin vests
       And impersonate Clark Gable
       It's a busy life in Camelot.
       I have to push the pram a lot.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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

--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101302043.10UKhfY5756461%40masaka.moolenaar.net.

Raspunde prin e-mail lui