Patch 9.0.0031
Problem:    <cmod> of user command does not have correct verbose value.
Solution:   Use the value from the command modifier. (closes #10651)
Files:      runtime/doc/map.txt, src/usercmd.c,
            src/testdir/test_usercommands.vim


*** ../vim-9.0.0030/runtime/doc/map.txt 2022-06-28 11:21:06.000000000 +0100
--- runtime/doc/map.txt 2022-07-03 13:10:50.219825183 +0100
***************
*** 1721,1730 ****
                nothing. Supported modifiers are |:aboveleft|, |:belowright|,
                |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
                |:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
!               |:lockmarks|, |:noswapfile| |:rightbelow|, |:silent|, |:tab|,
!               |:topleft|, |:verbose|, and |:vertical|.
!               Note that these are not yet supported: |:noautocmd|,
!               |:sandbox| and |:unsilent|.
                Examples: >
                    command! -nargs=+ -complete=file MyEdit
                                \ for f in expand(<q-args>, 0, 1) |
--- 1721,1730 ----
                nothing. Supported modifiers are |:aboveleft|, |:belowright|,
                |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
                |:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
!               |:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|,
!               |:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|,
!               |:verbose|, and |:vertical|.
!               Note that |:filter| is not supported.
                Examples: >
                    command! -nargs=+ -complete=file MyEdit
                                \ for f in expand(<q-args>, 0, 1) |
*** ../vim-9.0.0030/src/usercmd.c       2022-05-07 12:41:40.000000000 +0100
--- src/usercmd.c       2022-07-03 13:10:50.223825130 +0100
***************
*** 1492,1501 ****
                        (cmod->cmod_flags & CMOD_ERRSILENT) ? "silent!"
                                                      : "silent", &multi_mods);
      // :verbose
!     if (p_verbose > 0)
!       result += add_cmd_modifier(buf, "verbose", &multi_mods);
      // flags from cmod->cmod_split
      result += add_win_cmd_modifers(buf, cmod, &multi_mods);
      if (quote && buf != NULL)
      {
        buf += result - 2;
--- 1492,1514 ----
                        (cmod->cmod_flags & CMOD_ERRSILENT) ? "silent!"
                                                      : "silent", &multi_mods);
      // :verbose
!     if (cmod->cmod_verbose > 0)
!     {
!       int verbose_value = cmod->cmod_verbose - 1;
! 
!       if (verbose_value == 1)
!           result += add_cmd_modifier(buf, "verbose", &multi_mods);
!       else
!       {
!           char verbose_buf[NUMBUFLEN];
! 
!           sprintf(verbose_buf, "%dverbose", verbose_value);
!           result += add_cmd_modifier(buf, verbose_buf, &multi_mods);
!       }
!     }
      // flags from cmod->cmod_split
      result += add_win_cmd_modifers(buf, cmod, &multi_mods);
+ 
      if (quote && buf != NULL)
      {
        buf += result - 2;
*** ../vim-9.0.0030/src/testdir/test_usercommands.vim   2022-05-06 
21:22:19.000000000 +0100
--- src/testdir/test_usercommands.vim   2022-07-03 13:10:50.219825183 +0100
***************
*** 58,64 ****
    call assert_equal('lockmarks', g:mods)
    loc MyCmd
    call assert_equal('lockmarks', g:mods)
!   " noautocmd MyCmd
    noswapfile MyCmd
    call assert_equal('noswapfile', g:mods)
    nos MyCmd
--- 58,67 ----
    call assert_equal('lockmarks', g:mods)
    loc MyCmd
    call assert_equal('lockmarks', g:mods)
!   noautocmd MyCmd
!   call assert_equal('noautocmd', g:mods)
!   noa MyCmd
!   call assert_equal('noautocmd', g:mods)
    noswapfile MyCmd
    call assert_equal('noswapfile', g:mods)
    nos MyCmd
***************
*** 72,100 ****
    call assert_equal('silent', g:mods)
    sil MyCmd
    call assert_equal('silent', g:mods)
    tab MyCmd
    call assert_equal('tab', g:mods)
    topleft MyCmd
    call assert_equal('topleft', g:mods)
    to MyCmd
    call assert_equal('topleft', g:mods)
!   " unsilent MyCmd
    verbose MyCmd
    call assert_equal('verbose', g:mods)
    verb MyCmd
    call assert_equal('verbose', g:mods)
    vertical MyCmd
    call assert_equal('vertical', g:mods)
    vert MyCmd
    call assert_equal('vertical', g:mods)
  
    aboveleft belowright botright browse confirm hide keepalt keepjumps
!             \ keepmarks keeppatterns lockmarks noswapfile silent tab
!             \ topleft verbose vertical MyCmd
  
    call assert_equal('browse confirm hide keepalt keepjumps ' .
!       \ 'keepmarks keeppatterns lockmarks noswapfile silent ' .
!       \ 'verbose aboveleft belowright botright tab topleft vertical', g:mods)
  
    let g:mods = ''
    command! -nargs=* MyQCmd let g:mods .= '<q-mods> '
--- 75,117 ----
    call assert_equal('silent', g:mods)
    sil MyCmd
    call assert_equal('silent', g:mods)
+   silent! MyCmd
+   call assert_equal('silent!', g:mods)
+   sil! MyCmd
+   call assert_equal('silent!', g:mods)
    tab MyCmd
    call assert_equal('tab', g:mods)
    topleft MyCmd
    call assert_equal('topleft', g:mods)
    to MyCmd
    call assert_equal('topleft', g:mods)
!   unsilent MyCmd
!   call assert_equal('unsilent', g:mods)
!   uns MyCmd
!   call assert_equal('unsilent', g:mods)
    verbose MyCmd
    call assert_equal('verbose', g:mods)
    verb MyCmd
    call assert_equal('verbose', g:mods)
+   0verbose MyCmd
+   call assert_equal('0verbose', g:mods)
+   3verbose MyCmd
+   call assert_equal('3verbose', g:mods)
+   999verbose MyCmd
+   call assert_equal('999verbose', g:mods)
    vertical MyCmd
    call assert_equal('vertical', g:mods)
    vert MyCmd
    call assert_equal('vertical', g:mods)
  
    aboveleft belowright botright browse confirm hide keepalt keepjumps
!             \ keepmarks keeppatterns lockmarks noautocmd noswapfile silent
!             \ tab topleft unsilent verbose vertical MyCmd
  
    call assert_equal('browse confirm hide keepalt keepjumps ' .
!       \ 'keepmarks keeppatterns lockmarks noswapfile unsilent noautocmd ' .
!       \ 'silent verbose aboveleft belowright botright tab topleft vertical',
!       \ g:mods)
  
    let g:mods = ''
    command! -nargs=* MyQCmd let g:mods .= '<q-mods> '
*** ../vim-9.0.0030/src/version.c       2022-07-02 20:47:57.004693455 +0100
--- src/version.c       2022-07-03 13:12:13.466783768 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     31,
  /**/

-- 
It is hard to understand how a cemetery raised its burial
cost and blamed it on the cost of living.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220703121644.B08E71C0EFC%40moolenaar.net.

Raspunde prin e-mail lui