On Fr, 20 Jan 2017, desjardinsm wrote:

> When "set wildoptions=tagfile" it actually changes the way the ":h 
> tag-regexp" for completion works.  With the default wildoptions of course a 
> ":tag /<c-d>" will work as the help describes.  But with wildoptions set, 
> ":tag /<c-d>" only lists tags starting with "/".
> 
> This occurs with "vim -Nu NONE" as well, after setting 'wop'.
> 
> This also only affects its completion.  The actual command uses the "/" as 
> expected.

This happens, because setting wildoptions=tagfile changes the completion 
context and addstar() does not test for the EXPAND_TAGS_LISTFILES 
expansion correctly, therefore adding a '^' to the pattern which will 
then break the expectation of the expand_tags() function.


Attached patch fixes it and adds a test.

Best,
Christian
-- 
Das ist ein Land der Lebenden und ein Land der Toten, und die Brücke
zwischen ihnen ist die Liebe - das einzig Bleibende, der einzige
Sinn...
                -- Thornton Niven Wilder

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.
From 85d448ab4fbc71a3a4971ecb96427aa330da09a8 Mon Sep 17 00:00:00 2001
From: Christian Brabandt <[email protected]>
Date: Mon, 23 Jan 2017 22:14:11 +0100
Subject: [PATCH] Expanding tags on the commandline does not respect
 'wildoptions'

setting 'wildoptions=tagfile' changes how tags are expanded on the
commandline. This happens because addstar() funtion does not test for
the EXPAND_TAGS_LISTFILES expansion mode and therefore adds a ^ to the
pattern, which then will breaks expand_tags() function.

Add a test to verify its behaviour.

Closes #1399
---
 src/ex_getln.c               |  3 ++-
 src/testdir/test_cmdline.vim | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 581c44492..4b7ae75e9 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4357,7 +4357,8 @@ addstar(
 		|| context == EXPAND_OWNSYNTAX
 		|| context == EXPAND_FILETYPE
 		|| context == EXPAND_PACKADD
-		|| (context == EXPAND_TAGS && fname[0] == '/'))
+		|| ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS)
+		    && fname[0] == '/'))
 	    retval = vim_strnsave(fname, len);
 	else
 	{
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 279a1681c..35defd400 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -295,3 +295,14 @@ func Test_illegal_address()
   2;')
   quit
 endfunc
+
+func Test_cmdline_complete_wildoptions()
+  help
+  call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
+  let a=join(sort(split(@:)),' ')
+  set wildoptions=tagfile
+  call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
+  let b=join(sort(split(@:)),' ')
+  call assert_equal(a, b)
+  bw!
+endfunc
-- 
2.11.0

Raspunde prin e-mail lui