mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
refactor s:GetPath() to take marks into account
This commit is contained in:
@@ -1912,10 +1912,7 @@ function! s:GetPath(ln)
|
|||||||
let wasdir = 0
|
let wasdir = 0
|
||||||
if curFile =~ '/$'
|
if curFile =~ '/$'
|
||||||
let wasdir = 1
|
let wasdir = 1
|
||||||
endif
|
let curFile = substitute(curFile, '/\?$', '/', "")
|
||||||
let curFile = substitute (curFile,' -> .*',"","") " remove link to
|
|
||||||
if wasdir == 1
|
|
||||||
let curFile = substitute (curFile, '/\?$', '/', "")
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1924,24 +1921,19 @@ function! s:GetPath(ln)
|
|||||||
while lnum > 0
|
while lnum > 0
|
||||||
let lnum = lnum - 1
|
let lnum = lnum - 1
|
||||||
let curLine = getline(lnum)
|
let curLine = getline(lnum)
|
||||||
|
let curLineStripped = s:StripMarkupFromLine(curLine, 1)
|
||||||
|
|
||||||
"have we reached the top of the tree?
|
"have we reached the top of the tree?
|
||||||
if curLine =~ '^/'
|
if curLine =~ '^/'
|
||||||
let sd = substitute (curLine, '[ ]*$', "", "")
|
let dir = substitute (curLine, ' *$', "", "") . dir
|
||||||
let dir = sd . dir
|
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
if curLine =~ '/$'
|
if curLineStripped =~ '/$'
|
||||||
let lpindent = match(curLine,s:tree_markup_reg_neg) / s:tree_wid
|
let lpindent = match(curLine,s:tree_markup_reg_neg) / s:tree_wid
|
||||||
if lpindent < indent
|
if lpindent < indent
|
||||||
let indent = indent - 1
|
let indent = indent - 1
|
||||||
let sd = substitute (curLine, '^' . s:tree_markup_reg . '*',"","")
|
|
||||||
let sd = substitute (sd, ' -> .*', '',"")
|
|
||||||
|
|
||||||
" remove leading escape
|
let dir = substitute (curLineStripped,'^\\', "", "") . dir
|
||||||
let sd = substitute (sd,'^\\', "", "")
|
|
||||||
|
|
||||||
let dir = sd . dir
|
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user