Hi Bram and Nice Vim developers,
2015/1/6(Tue) 4:58:27 UTC+9 Bram Moolenaar:
> Yasuhiro Matsumoto wrote:
>
> > bug.vim
> > -------------------
> > set nocompatible
> >
> > inoremap <F5> <C-R>=ListMonths()<CR>
> >
> > func! ListMonths()
> > call complete(col('.'), ['January', 'February', 'March',
> > \ 'April', 'May', 'June', 'July', 'August', 'September',
> > \ 'October', 'November', 'December'])
> > return ''
> > endfunc
> > -------------------
> >
> > 1. vim -u bug.vim -N
> >
> > 2. press F5
> >
> > 3. type Ctrl-L while popup menu is visible
> >
> > Ctrl-L should not behave like Ctrl-P. ins_compl_key2dir() handles
> > suffix keys after CTRL-X. And also it handles keys while popup menu is
> > visible (ex: CTRL-P/CTRL-N). This should be cleanly separated.
> >
> >
https://gist.github.com/mattn/2c83d5a17c9e9505e43d
>
> Thanks!
I update a patch. (Attached to this email)
Please check.
And ...
I found specification inconsistency between 'complete()' and 'backspace' option.
How to reproduce:
1. cat test.vim
inoremap <F5> <C-R>=ListMonths()<CR>
func! ListMonths()
call complete(1, ['One', 'Three'])
return ''
endfunc
2. vim -N -u test.vim
3. Enter insert-mode and input 'ab' and leave insert-mode.
iab<Esc>
4. Reenter insert-mode and use 'complete()'
a<F5>
5. Delete two characters.
<C-H><C-H>
What happen.
- '4.' Edit start columns 3, but 'complete()' starts 1 (by 1st argument).
- '5.' Can't delete column 1 and 2
'backspace' option not contain "start", So vim can not deleted this.
I think this is specification inconsistency.
How Let's fix?
(a) Occurred an error when 'comple()' first argument is can not be deleted by under the influence of the 'backspace' option.
(b) Adjust the first argument value implicitly in f_complete(). (In this case, Ajust 3)
(c) Between 'comple ()' is functioning to ignore the 'backspace' option.
I would write the patch when you are determined.