Mercurial > vim
comparison src/testdir/test_popup.vim @ 34329:a059fc613d55 v9.1.0098
patch 9.1.0098: CompletionChanged not triggered when new leader added without matches
Commit: https://github.com/vim/vim/commit/0d3c0a66a39570cbc52b9536604c39e324b989b3
Author: glepnir <glephunter@gmail.com>
Date: Sun Feb 11 17:52:40 2024 +0100
patch 9.1.0098: CompletionChanged not triggered when new leader added without matches
Problem: CompletionChanged not triggered when new leader added causing
no matching item in the completion menu
Solution: When completion is active but no items matched still trigger
CompletChanged event
(glepnir)
closes: #13982
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 11 Feb 2024 18:00:03 +0100 |
parents | f4ae2a159bde |
children |
comparison
equal
deleted
inserted
replaced
34328:d94ca764273d | 34329:a059fc613d55 |
---|---|
1137 set complete=. completeopt=noinsert,noselect,menuone | 1137 set complete=. completeopt=noinsert,noselect,menuone |
1138 function! OnPumChange() | 1138 function! OnPumChange() |
1139 let g:event = copy(v:event) | 1139 let g:event = copy(v:event) |
1140 let g:item = get(v:event, 'completed_item', {}) | 1140 let g:item = get(v:event, 'completed_item', {}) |
1141 let g:word = get(g:item, 'word', v:null) | 1141 let g:word = get(g:item, 'word', v:null) |
1142 let l:line = getline('.') | |
1143 if g:word == v:null && l:line == "bc" | |
1144 let g:word = l:line | |
1145 endif | |
1142 endfunction | 1146 endfunction |
1143 augroup AAAAA_Group | 1147 augroup AAAAA_Group |
1144 au! | 1148 au! |
1145 autocmd CompleteChanged * :call OnPumChange() | 1149 autocmd CompleteChanged * :call OnPumChange() |
1146 augroup END | 1150 augroup END |
1156 call assert_equal('foobar', g:word) | 1160 call assert_equal('foobar', g:word) |
1157 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-E>", 'tx') | 1161 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-E>", 'tx') |
1158 call assert_equal(v:null, g:word) | 1162 call assert_equal(v:null, g:word) |
1159 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx') | 1163 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx') |
1160 call assert_equal('foobar', g:word) | 1164 call assert_equal('foobar', g:word) |
1165 call feedkeys("S\<C-N>bc", 'tx') | |
1166 call assert_equal("bc", g:word) | |
1161 | 1167 |
1162 func Omni_test(findstart, base) | 1168 func Omni_test(findstart, base) |
1163 if a:findstart | 1169 if a:findstart |
1164 return col(".") | 1170 return col(".") |
1165 endif | 1171 endif |