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

Use :mode only in neovim. MacVim still needs to use :redraw! #1019

Merged
merged 5 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

#### 5.2...
- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! [#1019](https://github.com/scrooloose/nerdtree/pull/1019)
- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. [#1017](https://github.com/scrooloose/nerdtree/pull/1017)
- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/scrooloose/nerdtree/pull/1016)
- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/scrooloose/nerdtree/pull/1015)
Expand Down
20 changes: 18 additions & 2 deletions autoload/nerdtree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,24 @@ endfunction
" SECTION: General Functions {{{1
"============================================================

function! nerdtree#slash()
"FUNCTION: nerdtree#redraw(bang)
" Redraws the screen (Neovim uses the mode statement). If bang is TRUE, use
" redraw! instead of redraw.
function! nerdtree#redraw(bang)
if has('nvim')
mode
else
if a:bang
redraw!
else
redraw
endif
endif
endfunction

"FUNCTION: nerdtree#slash()
" Returns the directory separator based on OS and &shellslash
function! nerdtree#slash()
if nerdtree#runningWindows()
if exists('+shellslash') && &shellslash
return '/'
Expand Down Expand Up @@ -216,7 +232,7 @@ endfunction
"Args:
"msg: the message to echo
function! nerdtree#echo(msg)
redraw
call nerdtree#redraw(0)
echomsg empty(a:msg) ? "" : ("NERDTree: " . a:msg)
endfunction

Expand Down
6 changes: 3 additions & 3 deletions autoload/nerdtree/ui_glue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function! s:deleteBookmark(bookmark)

let l:choices = "&Yes\n&No"

echo | redraw
echo | call nerdtree#redraw(0)
let l:selection = confirm(l:message, l:choices, 1, 'Warning')

if l:selection != 1
Expand All @@ -266,7 +266,7 @@ function! s:deleteBookmark(bookmark)
call a:bookmark.delete()
silent call b:NERDTree.root.refresh()
call b:NERDTree.render()
echo | redraw
echo | call nerdtree#redraw(0)
catch /^NERDTree/
call nerdtree#echoWarning('could not remove bookmark')
endtry
Expand Down Expand Up @@ -577,7 +577,7 @@ function! s:refreshRoot()
call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w")
call b:NERDTree.root.refresh()
call b:NERDTree.render()
redraw
call nerdtree#redraw(0)
call nerdtree#exec(l:curWin . "wincmd w")
call nerdtree#echo("")
endfunction
Expand Down
4 changes: 2 additions & 2 deletions lib/nerdtree/menu_controller.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function! s:MenuController.showMenu()
let l:done = 0

while !l:done
mode
call nerdtree#redraw(1)
call self._echoPrompt()

let l:key = nr2char(getchar())
Expand All @@ -42,7 +42,7 @@ function! s:MenuController.showMenu()

" Redraw when "Ctrl-C" or "Esc" is received.
if !l:done || self.selection == -1
redraw!
call nerdtree#redraw(1)
endif
endtry

Expand Down
10 changes: 5 additions & 5 deletions nerdtree_plugin/fs_menu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function! s:inputPrompt(action)
endif

if g:NERDTreeMenuController.isMinimal()
redraw! " Clear the menu
call nerdtree#redraw(1) " Clear the menu
return minimal . " "
else
let divider = "=========================================================="
Expand Down Expand Up @@ -185,7 +185,7 @@ function! NERDTreeAddNode()
call newTreeNode.putCursorHere(1, 0)
endif

redraw!
call nerdtree#redraw(1)
catch /^NERDTree/
call nerdtree#echoWarning("Node Not Created.")
endtry
Expand Down Expand Up @@ -234,7 +234,7 @@ function! NERDTreeMoveNode()

call curNode.putCursorHere(1, 0)

redraw!
call nerdtree#redraw(1)
catch /^NERDTree/
call nerdtree#echoWarning("Node Not Renamed.")
endtry
Expand Down Expand Up @@ -272,7 +272,7 @@ function! NERDTreeDeleteNode()
call s:promptToDelBuffer(bufnum, prompt)
endif

redraw!
call nerdtree#redraw(1)
catch /^NERDTree/
call nerdtree#echoWarning("Could not remove node")
endtry
Expand Down Expand Up @@ -362,7 +362,7 @@ function! NERDTreeCopyNode()
call nerdtree#echo("Copy aborted.")
endif
let &shellslash = l:shellslash
redraw!
call nerdtree#redraw(1)
endfunction

" FUNCTION: NERDTreeCopyPath() {{{1
Expand Down