1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

Try expanding a terminal if configured

This commit is contained in:
Jan Larres
2013-08-30 16:57:27 +12:00
parent 24efd12f50
commit 4801c897f8
2 changed files with 10 additions and 7 deletions

View File

@@ -1711,7 +1711,8 @@ function! s:OpenWindow(flags) abort
" Expand the Vim window to accomodate for the Tagbar window if requested
" and save the window positions to be able to restore them later.
if g:tagbar_expand && !s:window_expanded && has('gui_running')
if g:tagbar_expand >= 1 && !s:window_expanded &&
\ (has('gui_running') || g:tagbar_expand == 2)
let s:window_pos.pre.x = getwinposx()
let s:window_pos.pre.y = getwinposy()
let &columns += g:tagbar_width + 1
@@ -1869,13 +1870,14 @@ function! s:CloseWindow() abort
if index(tablist, tagbarbufnr) == -1
let &columns -= g:tagbar_width + 1
let s:window_expanded = 0
" Only restore window position if it hasn't been moved manually
" after the expanding
if getwinposx() == s:window_pos.post.x &&
" Only restore window position if it is available and if the
" window hasn't been moved manually after the expanding
if getwinposx() != -1 &&
\ getwinposx() == s:window_pos.post.x &&
\ getwinposy() == s:window_pos.post.y
execute 'winpos ' . s:window_pos.pre.x .
\ ' ' . s:window_pos.pre.y
endif
endif
endif
endif

View File

@@ -491,8 +491,9 @@ Example:
g:tagbar_expand~
Default: 0
If this option is set the Vim window will be expanded by the width of the
Tagbar window if using a GUI version of Vim.
If this option is set to 1 the Vim window will be expanded by the width of the
Tagbar window if using a GUI version of Vim. Setting it to 2 will also try
expanding a terminal, but note that this is not supported by all terminals.
Example:
>