Commits

ZyX_I committed 2b60b24

ftplugin/aurumlog: Cleaner user prompting API

  • Participants
  • Parent commits dc59be5
  • Branches command-t

Comments (0)

Files changed (2)

File ftplugin/aurumlog.vim

     endif
     let file=0
     if len(files)==1
-        return call(a:cbargs[0], [a:bvar, a:hex, files[0]]+a:cbargs[1:], {})
+        return call(a:cbargs[0], [files[0]]+a:cbargs[1:], {})
     else
-        return s:F.promptuser(files, a:bvar, a:hex, a:cbargs)
+        return s:F.promptuser(files, a:cbargs)
     endif
 endfunction
 "▶1 promptuser
 let s:initialized_ruby=((has('ruby'))?(0):(-1))
-function s:F.promptuser(files, bvar, hex, cbargs)
+function s:F.promptuser(files, cbargs)
     if !s:initialized_ruby
         let s:initialized_ruby=1
         try
         lockvar s:initialized_ruby
     endif
     if s:initialized_ruby==1
-        let b:aurum_bvar=a:bvar
-        let b:aurum_hex=a:hex
         let [b:aurum_callback_fun; b:aurum_addargs]=a:cbargs
         ruby $comman_t_old = $command_t
         ruby $command_t = $aurum_command_t
         let choice=inputlist(['Select file (0 to cancel):']+
                     \        map(copy(a:files), '(v:key+1).". ".v:val'))
         if choice
-            return call(a:cbargs[0], [a:bvar, a:hex, a:files[choice-1]]+
-                        \            a:cbargs[1:], {})
+            return call(a:cbargs[0], [a:files[choice-1]]+a:cbargs[1:], {})
         endif
     endif
 endfunction
     let file=0
     let cbargs=copy(a:cbargs)
     let cbargs[0]=s:F.callbacks[cbargs[0]]
+    call extend(cbargs, [bvar, hex], 1)
     if spname=~#'\v^file\d+$'
         " XXX If fileN special exists, then files property was definitely added, 
         " so no need to use getcsprop()
-        return call(cbargs[0], [bvar, hex, cs.files[str2nr(spname[4:])]]+
-                    \          cbargs[1:], {})
+        return call(cbargs[0], [cs.files[str2nr(spname[4:])]]+cbargs[1:], {})
     else
         let file=s:F.getfile(bvar,
                     \        bvar.repo.functions.getcsprop(bvar.repo, cs,
 "▶1 Callbacks
 let s:F.callbacks={}
 "▶2 open
-function s:F.callbacks.open(bvar, hex, file)
+function s:F.callbacks.open(file, bvar, hex)
     call s:F.cwin(a:bvar)
     call s:_r.mrun('silent edit', 'file', a:bvar.repo, a:hex, a:file)
 endfunction
 "▶2 annotate
-function s:F.callbacks.annotate(bvar, hex, file)
-    call s:F.callbacks.open(a:bvar, a:hex, a:file)
+function s:F.callbacks.annotate(file, bvar, hex)
+    call s:F.callbacks.open(a:file, a:bvar, a:hex)
     AuAnnotate
 endfunction
 "▶2 diff
-function s:F.callbacks.diff(bvar, hex, file, ...)
+function s:F.callbacks.diff(file, bvar, hex, ...)
     call s:F.cwin(a:bvar)
     if a:0 && a:1
         call s:_r.mrun('silent edit', 'diff', a:bvar.repo,a:hex,'',[a:file],{})
     endif
 endfunction
 "▶2 filehistory
-function s:F.callbacks.filehistory(bvar, hex, file)
+function s:F.callbacks.filehistory(file, bvar, hex)
     let crrcond=((has_key(a:bvar.opts, 'crrestrict'))?
                 \   (string(a:bvar.opts.crrestrict).' isnot# v:key &&'):
                 \   (''))
     call s:_r.run('silent edit', 'log', a:bvar.repo, opts)
 endfunction
 "▶1 vimdiff
-function s:F.callbacks.vimdiff(bvar, hex, file, ...)
+function s:F.callbacks.vimdiff(file, bvar, hex, ...)
     let cs=a:bvar.repo.changesets[a:hex]
     call s:F.cwin(a:bvar)
     if a:0 && a:1

File ruby/command-t/finder/aurum_finder.rb

                 {'"'  => "\\\"",
                  "\n" => "\\n",
                  "\\" => "\\\\"}[s]}
-            ::VIM::evaluate "call(b:aurum_callback_fun, [b:aurum_bvar, b:aurum_hex, \"#{selection}\"]+b:aurum_addargs, {})"
+            ::VIM::evaluate "call(b:aurum_callback_fun, [\"#{selection}\"]+b:aurum_addargs, {})"
         end
     end
 end