Omni completion preview window not redraw properly

33 views
Skip to first unread message

Fabrizio Cabaleiro

unread,
Dec 13, 2019, 2:09:30 AM12/13/19
to vim...@vim.org
Bug description                         
When using omni completion, content of preview window and/or separation bar not redraw properly.

How to reproduce
Having jedi-vim plugin (commit c80a08d9835565bb8988d6314dfec616f70c53da):
$ mkdir $HOME/.vim/pack/python/start
$ cd    $HOME/.vim/pack/python/start
$ git clone --recursive https://github.com/davidhalter/jedi-vim.git

Using the following omnifunc:
$ cat test.vim
function! Omni_test(findstart, base)
   if(a:findstart)
      return col(".") - 1
   endif

   return [{"word":"one","info":"1info"},{"word":"two","info":"2info"}]
endfunction

set omnifunc=Omni_test

Start Vim:
$ vim -S test.vim  

And then press "i<c-x><c-o><c-n>"
After pressing Ctrl-n the content of the preview window is wrong.

Version
VIM - Vi IMproved 8.2

Compile configuration flags
./configure --enable-pythoninterp=yes --prefix $HOME/local

OS
Linux Arch 5.4.2-arch1-1 #1 SMP PREEMPT Thu, 05 Dec 2019 12:29:40 +0000 x86_64 GNU/Linux

Notes
I tracked the issue to commit 04357fbb87e65e50cc76295aec50114adb5cbd68

Issue was first seen when writing python, but it is not necessary to edit a python file to reproduce the issue, I just need to have the plugin jedi-vim.

Attached image shows the issue.
bug.png

Bram Moolenaar

unread,
Dec 13, 2019, 4:41:48 PM12/13/19
to vim...@googlegroups.com, Fabrizio Cabaleiro, vim...@vim.org

Fabrizio Cabaleiro wrote:

> *Bug description *
> When using omni completion, content of preview window and/or separation
> bar not redraw properly.
>
> *How to reproduce*
> Having jedi-vim plugin (commit c80a08d9835565bb8988d6314dfec616f70c53da):
> $ mkdir $HOME/.vim/pack/python/start
> $ cd    $HOME/.vim/pack/python/start
> $ git clone --recursive https://github.com/davidhalter/jedi-vim.git
>
> Using the following omnifunc:
> $ cat test.vim
> function! Omni_test(findstart, base)
>    if(a:findstart)
>       return col(".") - 1
>    endif
>
>    return [{"word":"one","info":"1info"},{"word":"two","info":"2info"}]
> endfunction
>
> set omnifunc=Omni_test
>
> Start Vim:
> $ vim -S test.vim
>
> And then press "i<c-x><c-o><c-n>"
> After pressing Ctrl-n the content of the preview window is wrong.
>
> *Version*
> VIM - Vi IMproved 8.2
>
> *Compile configuration flags*
> ./configure --enable-pythoninterp=yes --prefix $HOME/local
>
> *OS*
> Linux Arch 5.4.2-arch1-1 #1 SMP PREEMPT Thu, 05 Dec 2019 12:29:40 +0000
> x86_64 GNU/Linux
>
> *Notes*
> I tracked the issue to commit 04357fbb87e65e50cc76295aec50114adb5cbd68
>
> Issue was first seen when writing python, but it is not necessary to
> edit a python file to reproduce the issue, I just need to have the
> plugin jedi-vim.

I tried without that plugin and it appears to work fine.
So to me it sounds like that plugin is causing trouble.

--
hundred-and-one symptoms of being an internet addict:
269. You receive an e-mail from the wife of a deceased president, offering
to send you twenty million dollar, and you are not even surprised.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Fabrizio Cabaleiro

unread,
Dec 14, 2019, 3:08:00 PM12/14/19
to Bram Moolenaar, vim...@googlegroups.com, vim...@vim.org
I checked what jedi-vim was setting and I found the root cause, now
there is no need to have jedi-vim to reproduce. The problem is related
to 'completeopt' with longest.

Using the same test.vim from previous email, run vim as:

$ vim -S ~/test.vim --cmd 'set completeopt+=longest'
and then press 'i<c-x><c-o><c-n>'


Also, I found out that the issue is timing dependant, I was testing with
tmux and if I send all the keys at once, the issue is not visible, but
if I give a little delay to '<c-n>' the issue is there. To reproduce this:
Start tmux with
$ tmux
Split into two planes with
$ tmux split-pane
List panes with
$ tmux list-panes
The active pane should be %1 and the other should be %0
Now if I execute vim as
$ tmux send-keys -t %0 'vim -S test.vim --cmd "set
completeopt+=longest"' C-m 'i' C-x C-o C-n
The issue is not visible, but if I execute as
$ tmux send-keys -t %0 'vim -S test.vim --cmd "set
completeopt+=longest"' C-m 'i' C-x C-o ; sleep 1 ; tmux send-keys -t %0 C-n
The issue is there.

Bram Moolenaar

unread,
Dec 15, 2019, 8:56:17 AM12/15/19
to vim...@googlegroups.com, Fabrizio Cabaleiro, Bram Moolenaar, vim...@vim.org

Fabrizio Cabaleiro wrote:

> I checked what jedi-vim was setting and I found the root cause, now
> there is no need to have jedi-vim to reproduce. The problem is related
> to 'completeopt' with longest.
>
> Using the same test.vim from previous email, run vim as:
>
> $ vim -S ~/test.vim --cmd 'set completeopt+=longest'
> and then press 'i<c-x><c-o><c-n>'
>
>
> Also, I found out that the issue is timing dependant, I was testing with
> tmux and if I send all the keys at once, the issue is not visible, but
> if I give a little delay to '<c-n>' the issue is there. To reproduce this:
> Start tmux with
> $ tmux
> Split into two planes with
> $ tmux split-pane
> List panes with
> $ tmux list-panes
> The active pane should be %1 and the other should be %0
> Now if I execute vim as
> $ tmux send-keys -t %0 'vim -S test.vim --cmd "set
> completeopt+=longest"' C-m 'i' C-x C-o C-n
> The issue is not visible, but if I execute as
> $ tmux send-keys -t %0 'vim -S test.vim --cmd "set
> completeopt+=longest"' C-m 'i' C-x C-o ; sleep 1 ; tmux send-keys -t %0 C-n
> The issue is there.

Thanks for digging into this. I managed to reproduce it now.

Opening the preview window causes the popup to move, and redrawing
happens twice then. The first time the position isn't updated yet, and
a part of the redrawing is skipped. I'll fix that.


--
A KNIGHT rides into shot and hacks him to the ground. He rides off.
We stay for a moment on the glade. A MIDDLE-AGED LADY in a C. & A.
twin-set emerges from the trees and looks in horror at the body of her
HUSBAND.
MRS HISTORIAN: FRANK!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Fabrizio Cabaleiro

unread,
Dec 16, 2019, 2:40:00 AM12/16/19
to Bram Moolenaar, vim...@googlegroups.com, vim...@vim.org
Thank you very much for solving it so quickly.

What I was doing with jedi-vim is also back to normal.
Reply all
Reply to author
Forward
0 new messages