Merge branch 'master' into fix-multibyte-path

This commit is contained in:
bravestarr 2018-04-26 21:20:33 +08:00 committed by GitHub
commit abf200397f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 11 deletions

View File

@ -288,7 +288,7 @@ function! s:Bookmark.str()
let pathStr = self.path.str({'format': 'UI'}) let pathStr = self.path.str({'format': 'UI'})
if strdisplaywidth(pathStr) > pathStrMaxLen if strdisplaywidth(pathStr) > pathStrMaxLen
while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0 while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
let pathStr = substitute(pathStr, '.\{1}', '', '') let pathStr = substitute(pathStr, '^.', '', '')
endwhile endwhile
let pathStr = '<' . pathStr let pathStr = '<' . pathStr
endif endif

View File

@ -16,28 +16,34 @@ function! s:MenuController.New(menuItems)
endfunction endfunction
" FUNCTION: MenuController.showMenu() {{{1 " FUNCTION: MenuController.showMenu() {{{1
"start the main loop of the menu and get the user to choose/execute a menu " Enter the main loop of the NERDTree menu, prompting the user to select
"item " a menu item.
function! s:MenuController.showMenu() function! s:MenuController.showMenu()
call self._saveOptions() call self._saveOptions()
try try
let self.selection = 0 let self.selection = 0
let l:done = 0
let done = 0 while !l:done
while !done
redraw! redraw!
call self._echoPrompt() 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 endwhile
finally finally
call self._restoreOptions() call self._restoreOptions()
" Redraw when "Ctrl-C" or "Esc" is received.
if !l:done || self.selection == -1
redraw!
endif
endtry endtry
if self.selection != -1 if self.selection != -1
let m = self._current() let l:m = self._current()
call m.execute() call l:m.execute()
endif endif
endfunction endfunction

View File

@ -721,7 +721,7 @@ function! s:Path.str(...)
let limit = options['truncateTo'] let limit = options['truncateTo']
if strdisplaywidth(toReturn) > limit-1 if strdisplaywidth(toReturn) > limit-1
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0 while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
let toReturn = substitute(toReturn, '.\{1}', '', '') let toReturn = substitute(toReturn, '^.', '', '')
endwhile endwhile
if len(split(toReturn, '/')) > 1 if len(split(toReturn, '/')) > 1
let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/' let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'