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. Therefore, this patch, resets stop_insert_mode if it has been changed in insert_mode_completion: diff --git a/src/edit.c b/src/edit.c index 0ba2627..4386880 100644 --- a/src/edit.c +++ b/src/edit.c @@ -8235,6 +8235,7 @@ ins_reg(void) int regname; int literally = 0; int vis_active = VIsual_active; + int im_safe = stop_insert_mode; /* * If we are going to wait for a character, show a '"'. @@ -8317,12 +8318,15 @@ ins_reg(void) vim_beep(BO_REG); need_redraw = TRUE; /* remove the '"' */ } - else if (stop_insert_mode) + else if (stop_insert_mode && !im_safe) /* When the '=' register was used and a function was invoked that * did ":stopinsert" then stuff_empty() returns FALSE but we won't * insert anything, need to remove the '"' */ need_redraw = TRUE; + if (regname == '=') + stop_insert_mode = im_safe; + #ifdef FEAT_EVAL } --no_u_sync; Best, Christian -- Wir müssen das Alleinsein erst wieder lernen. Das ist heute eine schwierige Lektion. -- Anne Morrow Lindbergh -- -- 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.
