Explorar o código

Automatically delete the WinLeave autocommands

This is an alternative to #3494. Instead of wiping the quickfix buffer,
we're removing thte whole `augroup`.
Boris Staletic %!s(int64=5) %!d(string=hai) anos
pai
achega
defe02df00

+ 2 - 1
python/ycm/tests/client/command_request_test.py

@@ -110,7 +110,8 @@ class GoToResponse_QuickFix_test( object ):
       call( 'augroup ycmquickfix' ),
       call( 'autocmd! * <buffer>' ),
       call( 'autocmd WinLeave <buffer> '
-            'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif' ),
+            'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif '
+            '| autocmd! ycmquickfix' ),
       call( 'augroup END' ),
       call( 'doautocmd User YcmQuickFixOpened' )
     ] )

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

@@ -168,7 +168,8 @@ def OpenLocationList_test( vim_command, fitting_height, variable_exists ):
     call( 'augroup ycmlocation' ),
     call( 'autocmd! * <buffer>' ),
     call( 'autocmd WinLeave <buffer> '
-          'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif' ),
+          'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif '
+          '| autocmd! ycmlocation' ),
     call( 'augroup END' ),
     call( 'doautocmd User YcmLocationOpened' ),
     call( 'silent! wincmd p' )

+ 2 - 1
python/ycm/vimsupport.py

@@ -1253,5 +1253,6 @@ def AutoCloseOnCurrentBuffer( name ):
   vim.command( 'augroup {}'.format( name ) )
   vim.command( 'autocmd! * <buffer>' )
   vim.command( 'autocmd WinLeave <buffer> '
-               'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif' )
+               'if bufnr( "%" ) == expand( "<abuf>" ) | q | endif '
+               '| autocmd! {}'.format( name ) )
   vim.command( 'augroup END' )