From a233d603e336e32d24c52d01729a84860452fa60 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 8 Apr 2015 16:10:56 +0200 Subject: [PATCH] add_goto_window: pass len of list and use min() With less than `g:jedi#quickfix_window_height` entries in quickfix list, this now only makes the window that large, effectively saving screen space. --- autoload/jedi.vim | 5 +++-- jedi_vim.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/jedi.vim b/autoload/jedi.vim index ab79931..a1419af 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -96,10 +96,11 @@ endfunction " helper functions " ------------------------------------------------------------------------ -function! jedi#add_goto_window() +function! jedi#add_goto_window(len) set lazyredraw cclose - execute 'belowright copen '.g:jedi#quickfix_window_height + let height = min([a:len, g:jedi#quickfix_window_height]) + execute 'belowright copen '.height set nolazyredraw if g:jedi#use_tabs_not_buffers == 1 noremap :call jedi#goto_window_on_enter() diff --git a/jedi_vim.py b/jedi_vim.py index 6e5c847..13f49bf 100644 --- a/jedi_vim.py +++ b/jedi_vim.py @@ -236,7 +236,7 @@ def goto(is_definition=False, is_related_name=False, no_output=False): lnum=d.line, col=d.column + 1, text=PythonToVimStr(d.description))) vim_eval('setqflist(%s)' % repr(lst)) - vim_eval('jedi#add_goto_window()') + vim_eval('jedi#add_goto_window(' + str(len(lst)) + ')') return definitions