mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
Wrap saveScreenState's statements in a try-catch block. (#1047)
* Wrap saveScreenState's statements in a try-catch block. If you're in NERDTree, and you press : to open a command line, and then press Ctrl+F to open the [Command Line] window, you will see errors related to switching windows while in this function. (Those commands are not allowed while in the [Command Line] window.) The try-catch block handles the errors, preventing their being displayed. * Update version number in change log.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
#### 6.1...
|
#### 6.1...
|
||||||
|
- **.2**: Wrap saveScreenState's statements in a try-catch block. (PhilRunninger) [#1047](https://github.com/scrooloose/nerdtree/pull/1047)
|
||||||
- **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/scrooloose/nerdtree/pull/1045)
|
- **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/scrooloose/nerdtree/pull/1045)
|
||||||
- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043)
|
- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043)
|
||||||
#### 6.0...
|
#### 6.0...
|
||||||
|
|||||||
@@ -355,12 +355,15 @@ endfunction
|
|||||||
" scroll position
|
" scroll position
|
||||||
function! s:UI.saveScreenState()
|
function! s:UI.saveScreenState()
|
||||||
let win = winnr()
|
let win = winnr()
|
||||||
call g:NERDTree.CursorToTreeWin()
|
|
||||||
let self._screenState = {}
|
let self._screenState = {}
|
||||||
let self._screenState['oldPos'] = getpos(".")
|
try
|
||||||
let self._screenState['oldTopLine'] = line("w0")
|
call g:NERDTree.CursorToTreeWin()
|
||||||
let self._screenState['oldWindowSize']= winwidth("")
|
let self._screenState['oldPos'] = getpos(".")
|
||||||
call nerdtree#exec(win . "wincmd w", 1)
|
let self._screenState['oldTopLine'] = line("w0")
|
||||||
|
let self._screenState['oldWindowSize']= winwidth("")
|
||||||
|
call nerdtree#exec(win . "wincmd w", 1)
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI.setShowHidden(val) {{{1
|
" FUNCTION: s:UI.setShowHidden(val) {{{1
|
||||||
|
|||||||
Reference in New Issue
Block a user