Kikuchan wrote:
> I'm playing with complete() function, and I've found a bug in it.
>
> Acording to :help complete, it says:
> --------
> 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
> This isn't very useful, but it shows how it works. Note that
> an empty string is returned to avoid a zero being inserted.
> --------
>
> After loading this inoremap and function, and then I press F5 key,
> it shows and selects a first row of the list as a default.
>
> But sometimes when I press F5 again, it shows and selects a *second* row
> of the list as a default.
>
> How to reproduce:
> <F5><C-P><C-E><F5>
>
> I think this is a bug because the last <C-P> sets compl_direction variable
> in edit.c to BACKWARD, and it is misused to build up a list for completion
> on next complete() function call.
>
> The attached file contains a simple patch to fix it.
> # just one line, add 'compl_direction = FORWARD;'
>
>
> ... BTW, I need an extra feature for compelte() function.
> The complete() function doesn't allow an element that is empty.
>
> But, I want to show the elements have empty 'word', but non-empty 'abbr'.
> so I proposed to add 'empty' key, like 'dup' key.
>
> Bram, could you include this harmless feature, please? ;)
>
> See the attached patch for more details.
> It's very simple, and it doesn't change any default behavior.
I'll add a note in the todo list to look into this.
--
ZOOT: I'm afraid our life must seem very dull and quiet compared to yours.
We are but eightscore young blondes, all between sixteen and
nineteen-and-a-half, cut off in this castle, with no one to protect us.
Oooh. It is a lonely life ... bathing ... dressing ... undressing ...
making exciting underwear....
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php