FixUp: output window should set the global win id

This commit is contained in:
Ben Jackson 2020-07-18 13:51:05 +01:00
commit 47ace82364
2 changed files with 30 additions and 0 deletions

View file

@ -454,9 +454,17 @@ class DebugSession( object ):
def ShowOutput( self, category ):
if not self._outputView.WindowIsValid():
# TODO: The UI code is too scattered. Re-organise into a UI class that
# just deals with these thigns like window layout and custmisattion.
# currently, this class and the CodeView share some responsiblity for this
# and poking into each View class to check its window is valid also feels
# wrong.
with utils.LetCurrentTabpage( self._uiTab ):
vim.command( f'botright { settings.Int( "bottombar_height", 10 ) }new' )
self._outputView.UseWindow( vim.current.window )
vim.vars[ 'vimspector_session_windows' ][ 'output' ] = utils.WindowID(
vim.current.window,
self._uiTab )
self._outputView.ShowOutput( category )

View file

@ -310,6 +310,28 @@ function! Test_CloseOutput_Early()
\ ] ],
\ winlayout( g:vimspector_session_windows.tabpage ) )
" Open it again!
let g:vimspector_bottombar_height = 5
VimspectorShowOutput Console
call assert_equal(
\ [ 'col', [
\ [ '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 ],
\ ] ],
\ [ 'leaf', g:vimspector_session_windows.output ]
\ ] ],
\ winlayout( g:vimspector_session_windows.tabpage ) )
" The actual height reported is the number of lines visible. The WinBar takes
" 1 screen row, so g:vimspector_bottombar_height -1
call assert_equal( 4, winheight( g:vimspector_session_windows.output ) )
au! TestCustomUI
call vimspector#test#setup#Reset()
%bwipe!