Browse Source

Auto merge of #2436 - dojoteef:reuse_preview_buffer, r=micbou

Address #1366 by reusing a single preview buffer

* Additionally set the preview buffer to be unlisted so it does not interfere with commands like :bnext
* See [my comment](https://github.com/Valloric/YouCompleteMe/issues/1366#issuecomment-259878581) for more details

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2436)
<!-- Reviewable:end -->
Homu 8 years ago
parent
commit
195509285c
2 changed files with 4 additions and 0 deletions
  1. 2 0
      python/ycm/tests/vimsupport_test.py
  2. 2 0
      python/ycm/vimsupport.py

+ 2 - 0
python/ycm/tests/vimsupport_test.py

@@ -1262,6 +1262,8 @@ def WriteToPreviewWindow_test( vim_current, vim_command ):
     call( 'modifiable', True ),
     call( 'readonly', False ),
     call( 'buftype', 'nofile' ),
+    call( 'bufhidden', 'wipe' ),
+    call( 'buflisted', False ),
     call( 'swapfile', False ),
     call( 'modifiable', False ),
     call( 'modified', False ),

+ 2 - 0
python/ycm/vimsupport.py

@@ -919,6 +919,8 @@ def WriteToPreviewWindow( message ):
     vim.current.buffer[:] = message.splitlines()
 
     vim.current.buffer.options[ 'buftype' ]    = 'nofile'
+    vim.current.buffer.options[ 'bufhidden' ]  = 'wipe'
+    vim.current.buffer.options[ 'buflisted' ]  = False
     vim.current.buffer.options[ 'swapfile' ]   = False
     vim.current.buffer.options[ 'modifiable' ] = False
     vim.current.buffer.options[ 'readonly' ]   = True