function! gina#command#_raw#call(range, args, mods) abort
  let git = gina#core#get()
  let args = gina#command#parse_args(matchstr(a:args, '^_raw\s\+\zs.*'))
  let pipe = copy(s:pipe)
  return gina#process#open(git, args, pipe)
endfunction

function! gina#command#_raw#complete(arglead, cmdline, cursorpos) abort
  return gina#complete#filename#any(a:arglead, a:cmdline, a:cursorpos)
endfunction


" Pipe -----------------------------------------------------------------------
let s:pipe_super = gina#process#pipe#echo()
let s:pipe = deepcopy(s:pipe_super)

function! s:pipe.on_exit(job, msg, event) abort
  call call(s:pipe_super.on_exit, [a:job, a:msg, a:event], self)
  call gina#core#emitter#emit(
        \ 'command:called:raw',
        \ self.params.scheme,
        \)
endfunction


" Event ----------------------------------------------------------------------
function! s:on_command_called_raw(...) abort
  call gina#core#emitter#emit('modified:delay')
endfunction


if !exists('s:subscribed')
  let s:subscribed = 1
  call gina#core#emitter#subscribe(
        \ 'command:called:raw',
        \ function('s:on_command_called_raw')
        \)
endif

function! gina#command#_raw#call(range, args, mods) abort
  let git = gina#core#get()
  let args = gina#command#parse_args(matchstr(a:args, '^_raw\s\+\zs.*'))
  let pipe = extend(gina#process#pipe#echo(), s:pipe)
  return gina#process#open(git, args, pipe)
endfunction

function! gina#command#_raw#complete(arglead, cmdline, cursorpos) abort
  return gina#complete#filename#any(a:arglead, a:cmdline, a:cursorpos)
endfunction


" Pipe -----------------------------------------------------------------------
let s:pipe_super = gina#process#pipe#echo()
let s:pipe = {}

function! s:pipe.on_exit(job, msg, event) abort
  call call(s:pipe_super.on_exit, [a:job, a:msg, a:event], self)
  call gina#core#emitter#emit(
        \ 'command:called:raw',
        \ self.params.scheme,
        \)
endfunction


" Event ----------------------------------------------------------------------
function! s:on_command_called_raw(...) abort
  call gina#core#emitter#emit('modified:delay')
endfunction


if !exists('s:subscribed')
  let s:subscribed = 1
  call gina#core#emitter#subscribe(
        \ 'command:called:raw',
        \ function('s:on_command_called_raw')
        \)
endif

Fix messaging bug on Vim 8
Fix messaging bug on Vim 8

The internal variable of pipe has copied and so the messages were duplicated.

lambdalisue/gina.vim