Friday, September 7, 2018

Cursor stays in command line after echo invoked with pumvisible() == 1

If you run `vim --clean` (I have tried with Vim 8.1.300) and
source this:

fun! Act()
echo "The cursor gets stuck here ->"
return ''
endf

" 1. Trigger keyword completion (<c-x><c-n)
" 2. Force waiting for the pop-up menu to appear (<c-r>==''<cr>)
" 3. Invoke Act() with pumvisible() == 1 (<plug>(Act)
fun! Complete()
return "\<c-x>\<c-n>\<c-r>=''\<cr>\<plug>(Act)"
endf

imap <silent> <expr> <plug>(Act) Act()
imap <expr> <tab> Complete()

set completeopt=menu
set noshowmode

then (in the same buffer) type something like `s<tab>`: you should see
that the pop-up menu appears, but the cursor stays in the command line
until you press another character.

Is there a way to avoid that, i.e., to have the cursor stays in the
buffer? Tried redraw after echo, but it does not change anything;
redraw! leaves the cursor at the bottom-right angle of the menu instead.

Thanks,
Life.


--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: