]> granicus.if.org Git - vim/commitdiff
patch 8.2.3377: Vim9: :disass completion does not understand "s:" v8.2.3377
authorBram Moolenaar <Bram@vim.org>
Thu, 26 Aug 2021 14:39:58 +0000 (16:39 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 26 Aug 2021 14:39:58 +0000 (16:39 +0200)
Problem:    Vim9: :disass completion does not understand "s:".
Solution:   Expand "s:" to a pattern. (closes #8780)

src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 362ed77e248cd9cbad8489a9c201fb0e0fc301ef..27fda786679bd24e15170981d0ded62e5b8d1ccd 100644 (file)
@@ -2073,7 +2073,9 @@ ExpandFromContext(
 
     // When expanding a function name starting with s:, match the <SNR>nr_
     // prefix.
-    if (xp->xp_context == EXPAND_USER_FUNC && STRNCMP(pat, "^s:", 3) == 0)
+    if ((xp->xp_context == EXPAND_USER_FUNC
+                                      || xp->xp_context == EXPAND_DISASSEMBLE)
+           && STRNCMP(pat, "^s:", 3) == 0)
     {
        int len = (int)STRLEN(pat) + 20;
 
index bd2ca03b60ad8601b3c31fc66b8dd5f556117a87..f7f55aa60dc9428425ff3cb96c4d582e35977889 100644 (file)
@@ -751,6 +751,11 @@ func Test_cmdline_complete_expression()
   unlet g:SomeVar
 endfunc
 
+" Unique function name for completion below
+func s:WeirdFunc()
+  echo 'weird'
+endfunc
+
 " Test for various command-line completion
 func Test_cmdline_complete_various()
   " completion for a command starting with a comment
@@ -833,6 +838,9 @@ func Test_cmdline_complete_various()
   call feedkeys(":disas profile Test_cmdline_complete_var\<C-A>\<C-B>\"\<CR>", 'xt')
   call assert_equal("\"disas profile Test_cmdline_complete_various", @:)
 
+  call feedkeys(":disas s:WeirdF\<C-A>\<C-B>\"\<CR>", 'xt')
+  call assert_match('"disas <SNR>\d\+_WeirdFunc()', @:)
+
   " completion for the :match command
   call feedkeys(":match Search /pat/\<C-A>\<C-B>\"\<CR>", 'xt')
   call assert_equal("\"match Search /pat/\<C-A>", @:)
index 22dc4400456805e5e568fc572d4e54b20a3a35f6..7aa602f8fe89d17a375a1b044f6cf857426b8086 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3377,
 /**/
     3376,
 /**/