changeset 81:a42b0e63a8ea

Fixed some bug with filenames with spaces in them.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 07 Mar 2014 00:26:59 -0800
parents fac880dab04a
children 31801dcca77d
files plugin/lawrencium.vim
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Mon Feb 17 08:36:13 2014 -0800
+++ b/plugin/lawrencium.vim	Fri Mar 07 00:26:59 2014 -0800
@@ -135,6 +135,7 @@
 "
 function! s:parse_lawrencium_path(lawrencium_path, ...)
     let l:repo_path = s:shellslash(a:lawrencium_path)
+    let l:repo_path = substitute(l:repo_path, '\\ ', ' ', 'g')
     if l:repo_path =~? '\v^lawrencium://'
         let l:repo_path = strpart(l:repo_path, strlen('lawrencium://'))
     endif
@@ -325,7 +326,14 @@
         let l:arg_list = a:1
     endif
     let l:hg_command = g:lawrencium_hg_executable . ' --repository ' . shellescape(s:stripslash(self.root_dir))
-    let l:hg_command = l:hg_command . ' ' . a:command . ' ' . join(l:arg_list, ' ')
+    let l:hg_command = l:hg_command . ' ' . a:command
+    for l:arg in l:arg_list
+        if stridx(l:arg, ' ') >= 0
+            let l:hg_command = l:hg_command . ' "' . l:arg . '"'
+        else
+            let l:hg_command = l:hg_command . ' ' . l:arg
+        endif
+    endfor
     return l:hg_command
 endfunction
 
@@ -354,6 +362,7 @@
     if a:0 == 0 || !a:1
         let l:path = self.GetRelativePath(a:path)
     endif
+    let l:path = escape(l:path, ' \')
     let l:result = 'lawrencium://' . s:stripslash(self.root_dir) . '//' . l:path
     if a:action !=? ''
         let l:result  = l:result . '//' . a:action
@@ -922,7 +931,7 @@
         endif
     endfor
     wincmd p
-    execute 'edit ' . l:filename
+    execute 'edit ' . escape(l:filename, ' \')
 endfunction
 
 function! s:HgStatus_AddRemove(linestart, lineend) abort