Try and be a bit smarter in auto mode

This commit is contained in:
Ben Jackson 2021-03-08 23:13:32 +00:00 • committed by Ben Jackson
commit 251a0ff314
2 changed files with 16 additions and 2 deletions

View file

@ -664,7 +664,19 @@ class DebugSession( object ):
mode = settings.Get( 'ui_mode' )
if mode == 'auto':
mode = 'vertical' if vim.options[ 'columns' ] < 160 else 'horizontal'
# Go vertical if there isn't enough horizontal space for at least:
# the left bar width
# + the code min width
# + the terminal min width
# + enough space for a sign column and number column?
min_width = ( settings.Int( 'sidebar_width' )
+ 1 + 2 + 3
+ settings.Int( 'code_minwidth' )
+ 1 + settings.Int( 'terminal_minwidth' ) )
mode = ( 'vertical'
if vim.options[ 'columns' ] < min_width
else 'horizontal' )
if mode == 'vertical':
self._SetUpUIVertical()

View file

@ -30,7 +30,9 @@ def LaunchTerminal( api_prefix,
# (this gives more vertical space, which becomes at at premium)
vim.vars[ 'vimspector_session_windows' ][ 'mode' ] == 'horizontal' or
vim.options[ 'columns' ] >= (
settings.Int( 'terminal_maxwidth' ) + settings.Int( 'code_minwidth' )
settings.Int( 'terminal_maxwidth' ) +
settings.Int( 'code_minwidth' ) +
1 # for the split decoration
)
),
'norestore': 1,