Skip to content

Commit

Permalink
Only swap with a valid window.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstein64 committed Jan 26, 2020
1 parent 0cc507c commit f0d749a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autoload/win.vim
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,12 @@ function! win#Win(...)
elseif l:char ==# 's' || l:char ==# 'S'
let l:swap_prompt = l:prompt + [['None', l:char]]
let l:swap_winnr = s:ScanWinnr(l:swap_prompt)
if l:swap_winnr !=# 0 | call s:Swap(l:swap_winnr) | endif
if l:char ==# 's' | execute l:swap_winnr . 'wincmd w' | endif
if l:swap_winnr !=# winnr()
\ && l:swap_winnr ># 0
\ && l:swap_winnr <= s:WindowCount()
call s:Swap(l:swap_winnr)
if l:char ==# 's' | execute l:swap_winnr . 'wincmd w' | endif
endif
elseif l:code >=# s:code1 && l:code <=# s:code9
let l:winnr = s:ScanWinnrDigits(l:prompt, [l:char])
if l:winnr !=# 0 | silent! execute l:winnr . 'wincmd w' | endif
Expand Down

0 comments on commit f0d749a

Please sign in to comment.