Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better check for MBE window #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions plugin/minibufexpl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,7 @@ function! <SID>StartExplorer(curBufNum)
" make the syntax highlight in MBE window working
call s:SwitchWindow('w',0,l:winNum)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('StartExplorer called in invalid window',1)
call <SID>DEBUG('Leaving StartExplorer()',10)
return
Expand Down Expand Up @@ -1090,8 +1089,7 @@ endfunction
function! <SID>DisplayBuffers(curBufNum)
call <SID>DEBUG('Entering DisplayExplorer('.a:curBufNum.')',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('DisplayBuffers called in invalid window',1)
return
endif
Expand Down Expand Up @@ -1120,8 +1118,7 @@ endfunction
function! <SID>ResizeWindow()
call <SID>DEBUG('Entering ResizeWindow()',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('ResizeWindow called in invalid window',1)
call <SID>DEBUG('Leaving ResizeWindow()',10)
return
Expand Down Expand Up @@ -1240,8 +1237,7 @@ endfunction
function! <SID>ShowBuffers()
call <SID>DEBUG('Entering ShowExplorer()',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('ShowBuffers called in invalid window',1)
call <SID>DEBUG('Leaving ShowBuffers()',10)
return
Expand Down Expand Up @@ -2185,8 +2181,7 @@ endfunction
function! <SID>GetSelectedBuffer()
call <SID>DEBUG('Entering GetSelectedBuffer()',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('GetSelectedBuffer called in invalid window',1)
call <SID>DEBUG('Leaving GetSelectedBuffer()',10)
return -1
Expand Down Expand Up @@ -2225,8 +2220,7 @@ endfunction
function! <SID>MBESelectBuffer(split)
call <SID>DEBUG('Entering MBESelectBuffer()',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('MBESelectBuffer called in invalid window',1)
call <SID>DEBUG('Leaving MBESelectBuffer()',10)
return
Expand Down Expand Up @@ -2282,8 +2276,7 @@ endfunction
function! <SID>MBEDeleteBuffer()
call <SID>DEBUG('Entering MBEDeleteBuffer()',10)

" Make sure we are in our window
if bufname('%') != '-MiniBufExplorer-'
if !s:IsOwnWindow()
call <SID>DEBUG('MBEDeleteBuffer called in invalid window',1)
call <SID>DEBUG('Leaving MBEDeleteBuffer()',10)
return
Expand Down Expand Up @@ -2496,4 +2489,13 @@ endfunction

" }}}

" }}}
" s:IsOwnWindow {{{
"
function! s:IsOwnWindow()
return bufname('%') =~ '-MiniBufExplorer-' && &buftype == 'nofile'
endfunction

" }}}

" vim:ft=vim:fdm=marker:ff=unix:nowrap:tabstop=2:shiftwidth=2:softtabstop=2:smarttab:shiftround:expandtab