1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:50:04 +08:00

Fix shell layer (#3608)

close #3485
This commit is contained in:
Wang Shidong 2020-07-04 21:20:11 +08:00 committed by GitHub
parent c13465348d
commit 8dfafda38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,14 +163,7 @@ function! s:open_default_shell(open_with_file_cwd) abort
endif endif
endfor endfor
" no terminal window found. Open a new window if s:default_position == 'float' && exists('*nvim_open_win')
let cmd = s:default_position ==# 'top' ?
\ 'topleft split' :
\ s:default_position ==# 'bottom' ?
\ 'botright split' :
\ s:default_position ==# 'right' ?
\ 'rightbelow vsplit' : 'leftabove vsplit'
if s:default_position == 'float'
let s:term_win_id = s:FLOAT.open_win(bufnr('%'), v:true, let s:term_win_id = s:FLOAT.open_win(bufnr('%'), v:true,
\ { \ {
\ 'relative': 'editor', \ 'relative': 'editor',
@ -182,6 +175,15 @@ function! s:open_default_shell(open_with_file_cwd) abort
exe win_id2win(s:term_win_id) . 'wincmd w' exe win_id2win(s:term_win_id) . 'wincmd w'
else else
" no terminal window found. Open a new window
let cmd = s:default_position ==# 'float' ?
\ 'topleft split' :
\ s:default_position ==# 'top' ?
\ 'topleft split' :
\ s:default_position ==# 'bottom' ?
\ 'botright split' :
\ s:default_position ==# 'right' ?
\ 'rightbelow vsplit' : 'leftabove vsplit'
exe cmd exe cmd
let lines = &lines * s:default_height / 100 let lines = &lines * s:default_height / 100
if lines < winheight(0) && (s:default_position ==# 'top' || s:default_position ==# 'bottom') if lines < winheight(0) && (s:default_position ==# 'top' || s:default_position ==# 'bottom')