changeset 181:0b4ccd0deceb

Fix broken test for whether the tag file is inside the project root.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Mar 2017 17:38:14 -0700
parents 8bac4b955c84
children 2489b4b54d5c
files autoload/gutentags/ctags.vim
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim	Thu Mar 23 16:00:24 2017 -0700
+++ b/autoload/gutentags/ctags.vim	Thu Mar 23 17:38:14 2017 -0700
@@ -69,7 +69,8 @@
     call gutentags#chdir(fnameescape(a:proj_dir))
 
     let l:tags_file_exists = filereadable(a:tags_file)
-    let l:tags_file_is_local = match(a:tags_file, '\v[/\\]') < 0
+    let l:tags_file_relative = fnamemodify(a:tags_file, ':.')
+    let l:tags_file_is_local = len(l:tags_file_relative) < len(a:tags_file)
 
     if l:tags_file_exists && g:gutentags_ctags_check_tagfile
         let l:first_lines = readfile(a:tags_file, '', 1)
@@ -91,7 +92,7 @@
         " confused if the paths have spaces -- but not if you're *in* the root 
         " directory, for some reason...
         let l:actual_proj_dir = '.'
-        let l:actual_tags_file = fnamemodify(a:tags_file, ':.')
+        let l:actual_tags_file = l:tags_file_relative
         call gutentags#chdir(fnameescape(a:proj_dir))
     else
         " else: the tags file goes in a cache directory, so we need to specify