From 2615cff97ad871de6ced52be93e72c310838543e Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 11 Mar 2021 21:14:30 +0000 Subject: [PATCH] If there isn't enough vertical space, we get vim errors (not enough room), so don't do that --- python3/vimspector/debug_session.py | 14 +++++++++++--- tests/ui.test.vim | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index 4a89cdf..16f69be 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -657,8 +657,6 @@ class DebugSession( object ): mode = settings.Get( 'ui_mode' ) - self._logger.debug( 'ui_mode = %s', mode ) - if mode == 'auto': # Go vertical if there isn't enough horizontal space for at least: # the left bar width @@ -670,13 +668,23 @@ class DebugSession( object ): + settings.Int( 'code_minwidth' ) + 1 + settings.Int( 'terminal_minwidth' ) ) + min_height = ( settings.Int( 'code_minheight' ) + 1 + + settings.Int( 'topbar_height' ) + 1 + + settings.Int( 'bottombar_height' ) + 1 + + 2 ) + mode = ( 'vertical' if vim.options[ 'columns' ] < min_width else 'horizontal' ) - self._logger.debug( 'min_width: %s, actual: %s - result: %s', + if vim.options[ 'lines' ] < min_height: + mode = 'horizontal' + + self._logger.debug( 'min_width/height: %s/%s, actual: %s/%s - result: %s', min_width, + min_height, vim.options[ 'columns' ], + vim.options[ 'lines' ], mode ) if mode == 'vertical': diff --git a/tests/ui.test.vim b/tests/ui.test.vim index 1f7789e..5ba2f9c 100644 --- a/tests/ui.test.vim +++ b/tests/ui.test.vim @@ -256,7 +256,7 @@ function! SetUp_Test_AutoLayoutTerminalVertVert() " Not wide enough to go horizontal, but wide enough to put the terminal and " code vertically split call vimspector#test#setup#PushOption( 'columns', 80 ) - call vimspector#test#setup#PushOption( 'lines', 30 ) + call vimspector#test#setup#PushOption( 'lines', 50 ) endfunction function! Test_AutoLayoutTerminalVertVert()