Permalink
Browse files

make the mouse work as expected with NERDTreeMouseMode

This was broken at some point - fix it.
  • Loading branch information...
1 parent 53bc776 commit e51a40c0d8294131510b77c89ccaa348a59bc5a7 @scrooloose committed Jan 11, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 plugin/NERD_tree.vim
View
@@ -151,7 +151,7 @@ let s:NERDTreeBufName = 'NERD_tree_'
let s:tree_wid = 2
if g:NERDTreeDirArrows
- let s:tree_markup_reg = '^ *\([▾▸] \)\?'
+ let s:tree_markup_reg = '^\([▾▸] \| \+[▾▸] \| \+\)'
else
let s:tree_markup_reg = '^[ `|]*[\-+~]'
endif
@@ -4058,16 +4058,20 @@ function! s:handleLeftClick()
endfor
if currentNode.path.isDirectory
- if startToCur =~# s:tree_markup_reg . '$' && startToCur =~# '[+~▾▸]$'
- call s:activateNode(currentNode)
+ if startToCur =~# s:tree_markup_reg && startToCur =~# '[+~▾▸] \?$'
+ call currentNode.activate()
return
endif
endif
if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
let char = strpart(startToCur, strlen(startToCur)-1, 1)
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
endif
endif

0 comments on commit e51a40c

Please sign in to comment.