Fix NERDTree opening with the wrong size. (#1008)

* Fix NERDTree opening with the wrong size.

There were two commands that seemed to be causing the NERDTree window to
open in exactly half the screen width. They are:

- silent! execute 'edit ' . t:NERDTreeBufName        in _createTreeWin()
- setlocal nobuflisted                         in _setCommonBufOptions()

These commands were reseting the width of NERDTree. The solution I chose
was to resize the window after creating the new window, and then to set
winfixwidth before setting the other common buffer options.

* Update change log and version number.
This commit is contained in:
Phil Runninger 2019-06-27 01:34:10 -04:00 committed by GitHub
parent 347a58b0b0
commit 2cbc76bbfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# Change Log # Change Log
### 5.1... ### 5.1...
- **`.2`**: Fix NERDTree opening with the wrong size. (@PhilRunninger) #1008
- **`.1`**: Update Changelog and create PR Template (@PhilRunninger) #1007 - **`.1`**: Update Changelog and create PR Template (@PhilRunninger) #1007
- **`.0`**: Too many changes for one patch... - **`.0`**: Too many changes for one patch...
- Refresh a dir_node if the file wasn't found in it, and look once more. (@PhilRunninger) #1005 - Refresh a dir_node if the file wasn't found in it, and look once more. (@PhilRunninger) #1005

View File

@ -4,7 +4,7 @@ endif
let g:loaded_nerdtree_autoload = 1 let g:loaded_nerdtree_autoload = 1
function! nerdtree#version() function! nerdtree#version()
return '5.1.1' return '5.1.2'
endfunction endfunction
" SECTION: General Functions {{{1 " SECTION: General Functions {{{1

View File

@ -189,18 +189,20 @@ function! s:Creator._createTreeWin()
let t:NERDTreeBufName = self._nextBufferName() let t:NERDTreeBufName = self._nextBufferName()
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new' silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
silent! execute 'edit ' . t:NERDTreeBufName silent! execute 'edit ' . t:NERDTreeBufName
silent! execute 'vertical resize '. l:splitSize
else else
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split' silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
silent! execute 'buffer ' . t:NERDTreeBufName silent! execute 'buffer ' . t:NERDTreeBufName
endif endif
setlocal winfixwidth
call self._setCommonBufOptions() call self._setCommonBufOptions()
if has('patch-7.4.1925') if has('patch-7.4.1925')
clearjumps clearjumps
endif endif
setlocal winfixwidth
endfunction endfunction
" FUNCTION: s:Creator._isBufHidden(nr) {{{1 " FUNCTION: s:Creator._isBufHidden(nr) {{{1