Merge pull request #4267 from watiko/vim-7.4.932

vim-patch:7.4.{926,932,933}
This commit is contained in:
Justin M. Keyes 2016-02-22 01:10:50 -05:00
commit 95230ec702
3 changed files with 60 additions and 12 deletions

View File

@ -2957,21 +2957,38 @@ ExpandOne (
}
}
/* Find longest common part */
// Find longest common part
if (mode == WILD_LONGEST && xp->xp_numfiles > 0) {
size_t len;
for (len = 0; xp->xp_files[0][len]; ++len) {
for (i = 0; i < xp->xp_numfiles; ++i) {
size_t mb_len = 1;
int c0;
int ci;
for (len = 0; xp->xp_files[0][len]; len += mb_len) {
if (has_mbyte) {
mb_len = (* mb_ptr2len)(&xp->xp_files[0][len]);
c0 = (* mb_ptr2char)(&xp->xp_files[0][len]);
} else {
c0 = xp->xp_files[0][len];
}
for (i = 1; i < xp->xp_numfiles; ++i) {
if (has_mbyte) {
ci =(* mb_ptr2char)(&xp->xp_files[i][len]);
} else {
ci = xp->xp_files[i][len];
}
if (p_fic && (xp->xp_context == EXPAND_DIRECTORIES
|| xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)) {
if (TOLOWER_LOC(xp->xp_files[i][len]) !=
TOLOWER_LOC(xp->xp_files[0][len]))
if (vim_tolower(c0) != vim_tolower(ci)) {
break;
} else if (xp->xp_files[i][len] != xp->xp_files[0][len])
}
} else if (c0 != ci) {
break;
}
}
if (i < xp->xp_numfiles) {
if (!(options & WILD_NO_BEEP)) {
vim_beep(BO_WILD);
@ -2979,8 +2996,9 @@ ExpandOne (
break;
}
}
ss = (char_u *)xstrndup((char *)xp->xp_files[0], len);
findex = -1; /* next p_wc gets first one */
findex = -1; // next p_wc gets first one
}
// Concatenate all matching names

View File

@ -355,16 +355,16 @@ static int included_patches[] = {
// 938 NA
// 937,
// 936,
// 935,
// 935 NA
// 934 NA
// 933,
// 932,
933,
932,
// 931 NA
// 930 NA
929,
// 928 NA
// 927 NA
// 926,
926,
// 925,
// 924 NA
// 923 NA

View File

@ -4,9 +4,10 @@ local helpers = require('test.functional.helpers')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
local eq, eval = helpers.eq, helpers.eval
local source = helpers.source
describe('utf8', function()
setup(clear)
before_each(clear)
it('is working', function()
insert('start:')
@ -50,4 +51,33 @@ describe('utf8', function()
eq(1, eval('strchars("\\u20dd", 0)'))
eq(1, eval('strchars("\\u20dd", 1)'))
end)
it('customlist completion', function()
source([[
function! CustomComplete1(lead, line, pos)
return ['', '']
endfunction
command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo]])
feed(":Test1 <C-L>'<C-B>$put='<CR>")
source([[
function! CustomComplete2(lead, line, pos)
return ['あたし', 'あたま', 'あたりめ']
endfunction
command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo]])
feed(":Test2 <C-L>'<C-B>$put='<CR>")
source([[
function! CustomComplete3(lead, line, pos)
return ['Nこ', 'Nん', 'Nぶ']
endfunction
command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo]])
feed(":Test3 <C-L>'<C-B>$put='<CR>")
expect([[
Test1
Test2
Test3 N]])
end)
end)