FixUp: Closing the output window causes errors on output
This commit is contained in:
parent
f8cbb7c5b6
commit
80afb153b9
3 changed files with 44 additions and 9 deletions
|
|
@ -157,11 +157,13 @@ class OutputView( object ):
|
||||||
|
|
||||||
|
|
||||||
def _CreateBuffer( self, category, file_name = None, cmd = None ):
|
def _CreateBuffer( self, category, file_name = None, cmd = None ):
|
||||||
if not self._window.valid:
|
win = self._window
|
||||||
return
|
if not win.valid:
|
||||||
|
# We need to borrow the current window
|
||||||
|
win = vim.current.window
|
||||||
|
|
||||||
with utils.LetCurrentWindow( self._window ):
|
with utils.LetCurrentWindow( win ):
|
||||||
with utils.RestoreCurrentBuffer( self._window ):
|
with utils.RestoreCurrentBuffer( win ):
|
||||||
|
|
||||||
if file_name is not None:
|
if file_name is not None:
|
||||||
assert cmd is None
|
assert cmd is None
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,10 @@ def RestoreCurrentWindow():
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
vim.current.tabpage = old_tabpage
|
if old_tabpage.valid:
|
||||||
vim.current.window = old_window
|
vim.current.tabpage = old_tabpage
|
||||||
|
if old_window.valid:
|
||||||
|
vim.current.window = old_window
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
@ -194,9 +196,10 @@ def RestoreCurrentBuffer( window ):
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
with RestoreCurrentWindow():
|
if window.valid:
|
||||||
vim.current.window = window
|
with RestoreCurrentWindow():
|
||||||
vim.current.buffer = old_buffer
|
vim.current.window = window
|
||||||
|
vim.current.buffer = old_buffer
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,36 @@ function! Test_CloseOutput()
|
||||||
%bwipe!
|
%bwipe!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! Test_CloseOutput_Early()
|
||||||
|
augroup TestCustomUI
|
||||||
|
au!
|
||||||
|
au User VimspectorUICreated
|
||||||
|
\ call win_execute( g:vimspector_session_windows.output, 'q' )
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
call s:StartDebugging()
|
||||||
|
|
||||||
|
call vimspector#StepOver()
|
||||||
|
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( s:fn, 25, 1 )
|
||||||
|
|
||||||
|
call assert_equal(
|
||||||
|
\ [ 'row', [
|
||||||
|
\ [ 'col', [
|
||||||
|
\ [ 'leaf', g:vimspector_session_windows.variables ],
|
||||||
|
\ [ 'leaf', g:vimspector_session_windows.watches ],
|
||||||
|
\ [ 'leaf', g:vimspector_session_windows.stack_trace ],
|
||||||
|
\ ] ],
|
||||||
|
\ [ 'leaf', g:vimspector_session_windows.code ],
|
||||||
|
\ [ 'leaf', g:vimspector_session_windows.terminal ],
|
||||||
|
\ ] ],
|
||||||
|
\ winlayout( g:vimspector_session_windows.tabpage ) )
|
||||||
|
|
||||||
|
au! TestCustomUI
|
||||||
|
call vimspector#test#setup#Reset()
|
||||||
|
%bwipe!
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! Test_CustomUI()
|
function! Test_CustomUI()
|
||||||
augroup TestCustomUI
|
augroup TestCustomUI
|
||||||
au!
|
au!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue