Am 2016-06-23 00:28, schrieb Christian Brabandt:
Bram,
I have a plugin (unicode.vim https://github.com/chrisbra/unicode.vim),
that allows to complete digraphs characters from insert mode using
i_CTRL-R_= and the complete() function.
I got an issue with the very first call of the completion function
(https://github.com/chrisbra/unicode.vim/issues/16#issuecomment-226560333)
On the very first call, when the unicode database is not available, the
plugin tries to download it using netrw. It basically calls :Nread
http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
After this is done, it parses the unicode database and presents a nice
popup menu. In the process of downloading the data, netrw resets some
options, among which is 'insertmode' That has the effect, that
stop_insert_mode() will be set to TRUE and upon returning from the
insert mode completion (i_CTRL-R_=) mapping, will end insert mode and
therefore, Vim is effectively in Normal mode, while the popup menu is
still drawn.
This has the funny effect, that for the user there does not seem to be
a
possibility to close the popupmenu anymore and it stays open, which is
very irritating.
This happens, although netrw is restoring the value after finishing
downloading, but stop_insert_mode is never reset to the old FALSE
value.
[...]
Here is a simple example, taken from :h complete() and slightly
adjusted:
inoremap <F5> <C-R>=ListMonths()<CR>
func! ListMonths()
set noinsertmode
call complete(col('.'), ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc
Note, after pressing <f5> in insert mode you are back in normal mode,
can navigate normally but the popupmenu is still active (and won't
disappear after e.g. :redraw!). Also :echo pumvisible() returns 1.
I'll try to add a testcase for that. Note, that noinsertmode should
be a no-op, as it is off by default.
Best,
Christian
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.