Merge pull request #1080 from preservim/restore_eventignore_in_finally_block

Ensure events are (or aren't) being ignored correctly.
This commit is contained in:
Phil Runninger 2020-01-16 13:29:33 -05:00 committed by GitHub
commit 26740d1157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 11 deletions

View File

@ -8,6 +8,7 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.4
- **.5**: Ensure events are (or aren't) being ignored correctly. (PhilRunninger) [#1080](https://github.com/preservim/nerdtree/pull/1080)
- **.4**: Prevent overwriting existing files/dirs on node move. (PhilRunninger) [#1079](https://github.com/preservim/nerdtree/pull/1079)
- **.3**: Fix regex that finds keyword for minimal menu. (PhilRunninger) [#1075](https://github.com/preservim/nerdtree/pull/1075)
- **.2**: Lint vimscript, fix errors and warnings, add CI job to review PRs (Caleb Maclennan) [#1071](https://github.com/preservim/nerdtree/pull/1071)

View File

@ -169,8 +169,11 @@ function! nerdtree#exec(cmd, ignoreAll) abort
if a:ignoreAll
set eventignore=all
endif
exec a:cmd
let &eventignore = old_ei
try
exec a:cmd
finally
let &eventignore = old_ei
endtry
endfunction
" FUNCTION: nerdtree#has_opt(options, name) {{{2

View File

@ -333,14 +333,17 @@ function! s:Creator._tabpagevar(tabnr, var)
let old_ei = &eventignore
set eventignore=all
exec 'tabnext ' . a:tabnr
let v = -1
if exists('t:' . a:var)
exec 'let v = t:' . a:var
endif
exec 'tabnext ' . currentTab
try
exec 'tabnext ' . a:tabnr
let v = -1
if exists('t:' . a:var)
exec 'let v = t:' . a:var
endif
exec 'tabnext ' . currentTab
let &eventignore = old_ei
finally
let &eventignore = old_ei
endtry
return v
endfunction

View File

@ -141,12 +141,12 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory)
let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'})
endif
" 1. ensure that a new buffer is loaded
call nerdtree#exec('badd ' . quotedFileName, 1)
call nerdtree#exec('badd ' . quotedFileName, 0)
" 2. ensure that all windows which display the just deleted filename
" display a buffer for a new filename.
let s:originalTabNumber = tabpagenr()
let s:originalWindowNumber = winnr()
call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1)
call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0)
call nerdtree#exec('tabnext ' . s:originalTabNumber, 1)
call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1)
" 3. We don't need a previous buffer anymore