make the mouse work as expected with NERDTreeMouseMode

This was broken at some point - fix it.
This commit is contained in:
Martin Grenfell 2012-01-11 13:44:19 +00:00
parent 53bc77644c
commit e51a40c0d8

View File

@ -151,7 +151,7 @@ let s:NERDTreeBufName = 'NERD_tree_'
let s:tree_wid = 2 let s:tree_wid = 2
if g:NERDTreeDirArrows if g:NERDTreeDirArrows
let s:tree_markup_reg = '^ *\([▾▸] \)\?' let s:tree_markup_reg = '^\([▾▸] \| \+[▾▸] \| \+\)'
else else
let s:tree_markup_reg = '^[ `|]*[\-+~]' let s:tree_markup_reg = '^[ `|]*[\-+~]'
endif endif
@ -4058,8 +4058,8 @@ function! s:handleLeftClick()
endfor endfor
if currentNode.path.isDirectory if currentNode.path.isDirectory
if startToCur =~# s:tree_markup_reg . '$' && startToCur =~# '[+~▾▸]$' if startToCur =~# s:tree_markup_reg && startToCur =~# '[+~▾▸] \?$'
call s:activateNode(currentNode) call currentNode.activate()
return return
endif endif
endif endif
@ -4067,7 +4067,11 @@ function! s:handleLeftClick()
if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3 if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
let char = strpart(startToCur, strlen(startToCur)-1, 1) let char = strpart(startToCur, strlen(startToCur)-1, 1)
if char !~# s:tree_markup_reg if char !~# s:tree_markup_reg
call s:activateNode(currentNode) if currentNode.path.isDirectory
call currentNode.activate()
else
call currentNode.activate({'reuse': 1, 'where': 'p'})
endif
return return
endif endif
endif endif