Commits

ZyX_I  committed 09adc67

Moved some escape calls into a separate function

  • Participants
  • Parent commits 347d432

Comments (0)

Files changed (4)

File doc/aurum.txt

       status revision;
     - for |aurum://diff| buffers file is file which diff is under cursor and 
       rev is either second or first diffed revision.
+    Note if {file} is not specified and buffer is one of |aurum://file|, 
+         |aurum://status| or |aurum://diff|, then {rev} argument will be 
+         ignored.
 
 AuCommit {options} [glob1 [glob2 [...]]]                           *:AuCommit*
     Commit files matching given globs (current file if no globs were given). 

File ftplugin/aurumlog.vim

     let epath=escape(bvar.repo.path, ':\')
     return ':silent edit '.
                 \fnameescape('aurum://log:'.epath.':'.opts.
-                \            'files:'.escape(file, ';,:\*?[{}').','.
+                \            'files:'.escape(s:_r.cmdutils.globescape(file),
+                \                            ';,:').','.
                 \            'crrestrict:files')."\n"
 endfunction
 "▶1 update

File plugin/aurum/cmdutils.vim

             \ 'nocurf': 'Failed to deduce which file was meant',
             \'nocfile': 'Unsure what should be commited',
         \}
+"▶1 globescape :: path → glob
+function s:F.globescape(path)
+    return escape(a:path, '\*?[]{}')
+endfunction
 "▶1 globtopattern :: glob[, catchstars] → pattern
 function s:F.globtopattern(glob, ...)
-    " XXX If more metacharacters will be supported, they must be added to 
-    " escape() calls in s:F.filehistory in ftplugin/aurumlog and in logfunc 
-    " call
     let r='\V\^'
     let g=substitute(a:glob, '\V//\+', '/', 'g')
     if g[-1:] is# '/'
 endfunction
 "▶1 Post cmdutils resource
 call s:_f.postresource('cmdutils', {'globtopat': s:F.globtopattern,
+            \                      'globescape': s:F.globescape,
             \                      'encodeopts': s:F.encodeopts,
             \                          'getrrf': s:F.getrrf,
             \                     'getdifffile': s:F.getdifffile,

File plugin/aurum/log.vim

             if curfile is 0
                 call remove(opts.files, 0)
             else
-                let opts.files[0]=escape(curfile, '\*?[{}')
+                let opts.files[0]=s:_r.cmdutils.globescape(curfile)
             endif
         endif
         if a:repopath is# ':'