From 63c59208c1f9eef7068a944f5c3033bd1a348b97 Mon Sep 17 00:00:00 2001 From: Phil Runninger Date: Sun, 14 Jul 2019 15:17:56 -0400 Subject: [PATCH] Revert #1019 to fix nvim artifacts and flickering. (#1021) * Revert "Use :mode only in neovim. MacVim still needs to use :redraw! (#1019)" This reverts commit 4ac07f52a312a24d82deba715ee489e6c5b00259. * If not Neovim, use `:redraw!` as was done before. * Update version number. * Fix punctuation in NERDTree Menu instructions. --- CHANGELOG.md | 1 + autoload/nerdtree.vim | 20 ++------------------ autoload/nerdtree/ui_glue.vim | 6 +++--- lib/nerdtree/menu_controller.vim | 10 +++++++--- nerdtree_plugin/fs_menu.vim | 10 +++++----- 5 files changed, 18 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 232fe7b..562ceee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log #### 5.2... +- **.8**: Revert [#1019](https://github.com/scrooloose/nerdtree/pull/1019) to fix nvim artifacts and flickering. (PhilRunninger) [#1021](https://github.com/scrooloose/nerdtree/pull/1021) - **.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) diff --git a/autoload/nerdtree.vim b/autoload/nerdtree.vim index d441859..20ef1be 100644 --- a/autoload/nerdtree.vim +++ b/autoload/nerdtree.vim @@ -22,24 +22,8 @@ endfunction " SECTION: General Functions {{{1 "============================================================ -"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 '/' @@ -232,7 +216,7 @@ endfunction "Args: "msg: the message to echo function! nerdtree#echo(msg) - call nerdtree#redraw(0) + redraw echomsg empty(a:msg) ? "" : ("NERDTree: " . a:msg) endfunction diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 76572fd..045e8ad 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -254,7 +254,7 @@ function! s:deleteBookmark(bookmark) let l:choices = "&Yes\n&No" - echo | call nerdtree#redraw(0) + echo | redraw let l:selection = confirm(l:message, l:choices, 1, 'Warning') if l:selection != 1 @@ -266,7 +266,7 @@ function! s:deleteBookmark(bookmark) call a:bookmark.delete() silent call b:NERDTree.root.refresh() call b:NERDTree.render() - echo | call nerdtree#redraw(0) + echo | redraw catch /^NERDTree/ call nerdtree#echoWarning('could not remove bookmark') endtry @@ -577,7 +577,7 @@ function! s:refreshRoot() call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w") call b:NERDTree.root.refresh() call b:NERDTree.render() - call nerdtree#redraw(0) + redraw call nerdtree#exec(l:curWin . "wincmd w") call nerdtree#echo("") endfunction diff --git a/lib/nerdtree/menu_controller.vim b/lib/nerdtree/menu_controller.vim index f027249..05e82d9 100644 --- a/lib/nerdtree/menu_controller.vim +++ b/lib/nerdtree/menu_controller.vim @@ -31,7 +31,11 @@ function! s:MenuController.showMenu() let l:done = 0 while !l:done - call nerdtree#redraw(1) + if has('nvim') + mode + else + redraw! + endif call self._echoPrompt() let l:key = nr2char(getchar()) @@ -42,7 +46,7 @@ function! s:MenuController.showMenu() " Redraw when "Ctrl-C" or "Esc" is received. if !l:done || self.selection == -1 - call nerdtree#redraw(1) + redraw! endif endtry @@ -64,7 +68,7 @@ function! s:MenuController._echoPrompt() echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): " else - echo "NERDTree Menu. " . navHelp . " . or the shortcuts indicated" + echo "NERDTree Menu. " . navHelp . ", or the shortcuts indicated" echo "=========================================================" for i in range(0, len(self.menuItems)-1) diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index 4ba653f..5c37e4d 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -78,7 +78,7 @@ function! s:inputPrompt(action) endif if g:NERDTreeMenuController.isMinimal() - call nerdtree#redraw(1) " Clear the menu + redraw! " Clear the menu return minimal . " " else let divider = "==========================================================" @@ -185,7 +185,7 @@ function! NERDTreeAddNode() call newTreeNode.putCursorHere(1, 0) endif - call nerdtree#redraw(1) + redraw! catch /^NERDTree/ call nerdtree#echoWarning("Node Not Created.") endtry @@ -234,7 +234,7 @@ function! NERDTreeMoveNode() call curNode.putCursorHere(1, 0) - call nerdtree#redraw(1) + redraw! catch /^NERDTree/ call nerdtree#echoWarning("Node Not Renamed.") endtry @@ -272,7 +272,7 @@ function! NERDTreeDeleteNode() call s:promptToDelBuffer(bufnum, prompt) endif - call nerdtree#redraw(1) + redraw! catch /^NERDTree/ call nerdtree#echoWarning("Could not remove node") endtry @@ -362,7 +362,7 @@ function! NERDTreeCopyNode() call nerdtree#echo("Copy aborted.") endif let &shellslash = l:shellslash - call nerdtree#redraw(1) + redraw! endfunction " FUNCTION: NERDTreeCopyPath() {{{1