From 36803323253e336e0d4a6efaa61c8b647ef78eba Mon Sep 17 00:00:00 2001 From: watiko Date: Mon, 15 Feb 2016 23:43:27 +0900 Subject: vim-patch:7.4.926 Problem: Completing the longest match doesn't work properly with multi-byte characters. Solution: When using multi-byte characters use another way to find the longest match. (Hirohito Higashi) https://github.com/vim/vim/commit/4f8fa1633cdfbd09a41160c8480fe67c198067e9 --- test/functional/legacy/utf8_spec.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua index c16b1c45f4..d2315b3590 100644 --- a/test/functional/legacy/utf8_spec.lua +++ b/test/functional/legacy/utf8_spec.lua @@ -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 :]]) + feed(":Test1 '$put='") + + source([[ + function! CustomComplete2(lead, line, pos) + return ['あたし', 'あたま', 'あたりめ'] + endfunction + command -nargs=1 -complete=customlist,CustomComplete2 Test2 :]]) + feed(":Test2 '$put='") + + source([[ + function! CustomComplete3(lead, line, pos) + return ['Nこ', 'Nん', 'Nぶ'] + endfunction + command -nargs=1 -complete=customlist,CustomComplete3 Test3 :]]) + feed(":Test3 '$put='") + + expect([[ + + Test1 + Test2 あた + Test3 N]]) + end) end) -- cgit From 4f3ea0379eb015fc7b4f93c15e3baadf1c17e7bd Mon Sep 17 00:00:00 2001 From: watiko Date: Tue, 16 Feb 2016 00:17:07 +0900 Subject: vim-patch:7.4.932 Problem: test_utf8 has confusing dummy command. Solution: Use a real command instead of a colon. https://github.com/vim/vim/commit/8f08dab18df6dbf6c4b4973fd2d480e4bffb82d8 --- test/functional/legacy/utf8_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua index d2315b3590..d33ba6b5fd 100644 --- a/test/functional/legacy/utf8_spec.lua +++ b/test/functional/legacy/utf8_spec.lua @@ -57,21 +57,21 @@ describe('utf8', function() function! CustomComplete1(lead, line, pos) return ['あ', 'い'] endfunction - command -nargs=1 -complete=customlist,CustomComplete1 Test1 :]]) + command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo]]) feed(":Test1 '$put='") source([[ function! CustomComplete2(lead, line, pos) return ['あたし', 'あたま', 'あたりめ'] endfunction - command -nargs=1 -complete=customlist,CustomComplete2 Test2 :]]) + command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo]]) feed(":Test2 '$put='") source([[ function! CustomComplete3(lead, line, pos) return ['Nこ', 'Nん', 'Nぶ'] endfunction - command -nargs=1 -complete=customlist,CustomComplete3 Test3 :]]) + command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo]]) feed(":Test3 '$put='") expect([[ -- cgit