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

Clear output when NERDTree menu is aborted #832

Merged
merged 3 commits into from
Apr 23, 2018
Merged
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
24 changes: 15 additions & 9 deletions lib/nerdtree/menu_controller.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,35 @@ function! s:MenuController.New(menuItems)
return newMenuController
endfunction

"FUNCTION: MenuController.showMenu() {{{1
"start the main loop of the menu and get the user to choose/execute a menu
"item
" FUNCTION: MenuController.showMenu() {{{1
" Enter the main loop of the NERDTree menu, prompting the user to select
" a menu item.
function! s:MenuController.showMenu()
call self._saveOptions()

try
let self.selection = 0
let l:done = 0

let done = 0
while !done
while !l:done
redraw!
call self._echoPrompt()
let key = nr2char(getchar())
let done = self._handleKeypress(key)

let l:key = nr2char(getchar())
let l:done = self._handleKeypress(l:key)
endwhile
finally
call self._restoreOptions()

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

if self.selection != -1
let m = self._current()
call m.execute()
let l:m = self._current()
call l:m.execute()
endif
endfunction

Expand Down