Add vertical (i.e. narrow) layout
This puts the 3 utility windows at the top, horizontally split, with the code view below. The terminal window is drawn either vertically split (if there's room) or horizontally split otherwise. The output window remains at tht bottom. We add equivalent sizing options too, setting some defauts that roughly work on my macbook pro. We try to guess the best layout to use. In particular we go into 'narrow' mode if there are not enough horizonal columns to fit the sidebar, code and at least the minimum terminal size. We also try to move the terminal to be horizontally spit (i.e. vertically stacked) if we can fit the max number of lines, but only the min number of columns. This is all a little heuristic, but when testing it myself, it feels good and tends to pick a good option by default. Users can always customise the ui mode (g:vimspector_ui_mode and all the various specific width options)
This commit is contained in:
parent
943ae6c7c9
commit
7d2770f3c4
5 changed files with 461 additions and 7 deletions
|
|
@ -50,3 +50,59 @@ function! vimspector#test#setup#Reset() abort
|
|||
call popup_clear()
|
||||
endfunction
|
||||
|
||||
let s:g_stack = {}
|
||||
|
||||
function! vimspector#test#setup#PushGlobal( name, value ) abort
|
||||
if !has_key( s:g_stack, a:name )
|
||||
let s:g_stack[ a:name ] = []
|
||||
endif
|
||||
|
||||
let old_value = get( g:, a:name, v:null )
|
||||
call add( s:g_stack[ a:name ], old_value )
|
||||
let g:[ a:name ] = a:value
|
||||
|
||||
return old_value
|
||||
endfunction
|
||||
|
||||
function! vimspector#test#setup#PopGlobal( name ) abort
|
||||
if !has_key( s:g_stack, a:name ) || len( s:g_stack[ a:name ] ) == 0
|
||||
return v:null
|
||||
endif
|
||||
|
||||
let old_value = s:g_stack[ a:name ][ -1 ]
|
||||
call remove( s:g_stack[ a:name ], -1 )
|
||||
|
||||
if old_value is v:null
|
||||
silent! call remove( g:, a:name )
|
||||
else
|
||||
let g:[ a:name ] = old_value
|
||||
endif
|
||||
|
||||
return old_value
|
||||
endfunction
|
||||
|
||||
let s:o_stack = {}
|
||||
|
||||
function! vimspector#test#setup#PushOption( name, value ) abort
|
||||
if !has_key( s:o_stack, a:name )
|
||||
let s:o_stack[ a:name ] = []
|
||||
endif
|
||||
|
||||
let old_value = v:null
|
||||
execute 'let old_value = &' . a:name
|
||||
call add( s:o_stack[ a:name ], old_value )
|
||||
execute 'set ' . a:name . '=' . a:value
|
||||
return old_value
|
||||
endfunction
|
||||
|
||||
function! vimspector#test#setup#PopOption( name ) abort
|
||||
if !has_key( s:o_stack, a:name ) || len( s:o_stack[ a:name ] ) == 0
|
||||
return v:null
|
||||
endif
|
||||
|
||||
let old_value = s:o_stack[ a:name ][ -1 ]
|
||||
call remove( s:o_stack[ a:name ], -1 )
|
||||
|
||||
execute 'set ' . a:name . '=' . old_value
|
||||
return old_value
|
||||
endfunction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue