aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShougo <Shougo.Matsu@gmail.com>2016-08-17 22:24:20 +0900
committerJustin M. Keyes <justinkz@gmail.com>2016-08-17 09:24:20 -0400
commitdfb6a5133b92ffb38bfb7201e91f3de328652558 (patch)
tree088602e29afaec7aa3536120a2278b258ae97d3d
parent6b48d25cbf053720a128bfc124d2ee211addcf5c (diff)
downloadrneovim-dfb6a5133b92ffb38bfb7201e91f3de328652558.tar.gz
rneovim-dfb6a5133b92ffb38bfb7201e91f3de328652558.tar.bz2
rneovim-dfb6a5133b92ffb38bfb7201e91f3de328652558.zip
vim-patch:7.4.2112 (#5175)
Problem: getcompletion(.., 'dir') returns a match with trailing "*" when there are no matches. (Chdiza) Solution: Return an empty list when there are no matches. Add a trailing slash to directories. (Yegappan Lakshmanan) Add tests for no matches. (closes vim/vim#947) https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/testdir/test_cmdline.vim36
-rw-r--r--src/nvim/version.c2
3 files changed, 38 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index f6545a5ca9..d936c9572a 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -9994,8 +9994,8 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv)
{
char_u *pat;
expand_T xpc;
- int options = WILD_KEEP_ALL | WILD_SILENT | WILD_USE_NL
- | WILD_LIST_NOTFOUND | WILD_NO_BEEP;
+ int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
+ | WILD_NO_BEEP;
if (p_wic) {
options |= WILD_ICASE;
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 438b20cc5e..902ec1c05d 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -47,45 +47,79 @@ func Test_getcompletion()
let l = getcompletion('v:n', 'var')
call assert_true(index(l, 'v:null') >= 0)
+ let l = getcompletion('v:notexists', 'var')
+ call assert_equal([], l)
let l = getcompletion('', 'augroup')
call assert_true(index(l, 'END') >= 0)
+ let l = getcompletion('blahblah', 'augroup')
+ call assert_equal([], l)
let l = getcompletion('', 'behave')
call assert_true(index(l, 'mswin') >= 0)
+ let l = getcompletion('not', 'behave')
+ call assert_equal([], l)
let l = getcompletion('', 'color')
call assert_true(index(l, 'default') >= 0)
+ let l = getcompletion('dirty', 'color')
+ call assert_equal([], l)
let l = getcompletion('', 'command')
call assert_true(index(l, 'sleep') >= 0)
+ let l = getcompletion('awake', 'command')
+ call assert_equal([], l)
let l = getcompletion('', 'dir')
- call assert_true(index(l, 'sautest') >= 0)
+ call assert_true(index(l, 'sautest/') >= 0)
+ let l = getcompletion('NoMatch', 'dir')
+ call assert_equal([], l)
let l = getcompletion('exe', 'expression')
call assert_true(index(l, 'executable(') >= 0)
+ let l = getcompletion('kill', 'expression')
+ call assert_equal([], l)
let l = getcompletion('tag', 'function')
call assert_true(index(l, 'taglist(') >= 0)
+ let l = getcompletion('paint', 'function')
+ call assert_equal([], l)
let l = getcompletion('run', 'file')
call assert_true(index(l, 'runtest.vim') >= 0)
+ let l = getcompletion('walk', 'file')
+ call assert_equal([], l)
let l = getcompletion('ha', 'filetype')
call assert_true(index(l, 'hamster') >= 0)
+ let l = getcompletion('horse', 'filetype')
+ call assert_equal([], l)
let l = getcompletion('z', 'syntax')
call assert_true(index(l, 'zimbu') >= 0)
+ let l = getcompletion('emacs', 'syntax')
+ call assert_equal([], l)
let l = getcompletion('jikes', 'compiler')
call assert_true(index(l, 'jikes') >= 0)
+ let l = getcompletion('break', 'compiler')
+ call assert_equal([], l)
+
+ helptags ALL
+ let l = getcompletion('last', 'help')
+ call assert_true(index(l, ':tablast') >= 0)
+ let l = getcompletion('giveup', 'help')
+ call assert_equal([], l)
let l = getcompletion('time', 'option')
call assert_true(index(l, 'timeoutlen') >= 0)
+ let l = getcompletion('space', 'option')
+ call assert_equal([], l)
let l = getcompletion('er', 'highlight')
call assert_true(index(l, 'ErrorMsg') >= 0)
+ let l = getcompletion('dark', 'highlight')
+ call assert_equal([], l)
" For others test if the name is recognized.
let names = ['buffer', 'environment', 'file_in_path',
diff --git a/src/nvim/version.c b/src/nvim/version.c
index aa337f9fae..1cb8d128aa 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -163,7 +163,7 @@ static int included_patches[] = {
// 2115,
// 2114,
// 2113,
- // 2112,
+ 2112,
// 2111,
// 2110,
// 2109,