Patch 9.0.1332
Problem:    Crash when using buffer-local user command in cmdline window.
            (Karl Yngve LervÄg)
Solution:   Use the right buffer to find the user command. (closes #12030,
            closes #12029)
Files:      src/usercmd.c, src/testdir/test_usercommands.vim


*** ../vim-9.0.1331/src/usercmd.c       2023-01-27 21:03:08.899101847 +0000
--- src/usercmd.c       2023-02-20 15:21:12.172330017 +0000
***************
*** 1838,1844 ****
      if (eap->cmdidx == CMD_USER)
        cmd = USER_CMD(eap->useridx);
      else
!       cmd = USER_CMD_GA(&curbuf->b_ucmds, eap->useridx);
  
      /*
       * Replace <> in the command by the arguments.
--- 1838,1844 ----
      if (eap->cmdidx == CMD_USER)
        cmd = USER_CMD(eap->useridx);
      else
!       cmd = USER_CMD_GA(&prevwin_curwin()->w_buffer->b_ucmds, eap->useridx);
  
      /*
       * Replace <> in the command by the arguments.
*** ../vim-9.0.1331/src/testdir/test_usercommands.vim   2022-12-19 
16:49:23.886882904 +0000
--- src/testdir/test_usercommands.vim   2023-02-20 15:21:12.172330017 +0000
***************
*** 856,861 ****
--- 856,870 ----
    bw!
  endfunc
  
+ " Test for using buffer-local user command from cmdwin.
+ func Test_buflocal_usercmd_cmdwin()
+   new
+   command -buffer TestCmd edit Test
+   " This used to crash Vim
+   call assert_fails("norm q::TestCmd\<CR>", 'E11:')
+   bw!
+ endfunc
+ 
  " Test for using a multibyte character in a user command
  func Test_multibyte_in_usercmd()
    command SubJapanesePeriodToDot exe "%s/\u3002/./g"
*** ../vim-9.0.1331/src/version.c       2023-02-20 14:35:16.999853781 +0000
--- src/version.c       2023-02-20 15:23:35.628587846 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1332,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
160. You get in the elevator and double-click the button for the floor
     you want.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20230220153544.54D011C0045%40moolenaar.net.

Raspunde prin e-mail lui