From 251a0ff3144ea66d0250f61b81df638762cb86da Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 8 Mar 2021 23:13:32 +0000 Subject: [PATCH] Try and be a bit smarter in auto mode --- python3/vimspector/debug_session.py | 14 +++++++++++++- python3/vimspector/terminal.py | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index e3f5530..f2783fc 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -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() diff --git a/python3/vimspector/terminal.py b/python3/vimspector/terminal.py index 305c8ff..08ec735 100644 --- a/python3/vimspector/terminal.py +++ b/python3/vimspector/terminal.py @@ -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,