Loading ...
Sorry, an error occurred while loading the content.

136025Re: Omnicomplete shows strange behavior when preview window is enabled

Expand Messages
  • Ben Fritz
    Feb 7, 2013
      On Thursday, February 7, 2013 10:23:47 AM UTC-6, Benjamin Isbarn wrote:
      > It might be an issue with Konsole. I use Konsole on all my machines. I
      >
      > downloaded xterm and tried it and it worked, but when i resized the window
      >
      > (the xterm window) i had the same issue.
      >

      It is not a terminal issue, I see it on Windows gvim. I see the issue with
      syntax folding enabled and closed folds in the window; I do not use
      cursorcolumn except for a quick mapping to toggle it on when I want to quickly
      find the cursor, then I toggle it back off.

      Today I finally had a reproducible situation where I see the issue, so I dug
      through my .vimrc to find the lines causing the problem.

      Here are the lines:

      " get rid of scrolloff option for certain buffers like the quickfix and
      " preview windows
      autocmd BufEnter *
      \ if (&ft=='qf' || &previewwindow || (bufname('%') ==# "__Tag_List__" || bufname("%")==?'__Tagbar__')) && !exists('s:scrolloff_sav') |
      \ let s:scrolloff_sav=&scrolloff |
      \ set scrolloff=0 |
      \ endif
      " File type will not be set on the first BufEnter
      autocmd Filetype qf
      \ if !exists('s:scrolloff_sav') |
      \ let s:scrolloff_sav=&scrolloff |
      \ set scrolloff=0 |
      \ endif
      autocmd BufLeave *
      \ if (&ft=='qf' || &previewwindow || (bufname('%') ==# "__Tag_List__" || bufname("%")==?'__Tagbar__')) && exists('s:scrolloff_sav') |
      \ let &scrolloff=s:scrolloff_sav |
      \ unlet s:scrolloff_sav |
      \ endif

      A few relevant settings:

      completeopt=menuone,preview
      omnifunc=ccomplete#Complete
      foldmethod=syntax
      scrolloff=5

      If I use the following procedure with the above autocmds in my .vimrc, I see the
      popup menu flash briefly and go invisible. The preview window gets updated
      properly as I press the <Up> and <Down> buttons as if the menu was visible.
      <C-N> and <C-P> work as they are supposed to. But the popup menu stays
      inivisible.

      1. Edit a C file (the one I used was a proprietary code file for my employer, I
      can't share it, sorry).
      2. Go to a place in the C file in a nested fold (in my code, it is 5 levels
      deep).
      3. Close all folds with zM
      4. Show the cursor line with zv
      5. Type a partial match and press <C-X><C-O> to start omnicompletion (which
      includes tags, I believe).

      Now I see the issue or not, depending on my autocmds above.

      I think what may be happening is that my autocmds are adjusting scrolloff on
      BufEnter/BufLeave, which triggers because the preview window is most likely
      entered to update it to show the completion menu info. When scrolloff is
      updated, the window positions may change. Perhaps changing window scroll
      position via autocmd while the completion menu is up causes problems.

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 21 messages in this topic