branch: mq patch not correctly displayed
also make the branch extension make use of the specific code to handle the mq output
This commit is contained in:
parent
cfb107c75f
commit
9f186d899a
@ -14,10 +14,10 @@ function! s:untracked_output(dict, buf)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:mq_output(buf, file)
|
function! airline#async#mq_output(buf, file)
|
||||||
let buf=a:buf
|
let buf=a:buf
|
||||||
if !empty(a:buf)
|
if !empty(a:buf)
|
||||||
if a:buf is# 'no patches applied ' ||
|
if a:buf =~# 'no patches applied' ||
|
||||||
\ a:buf =~# "unknown command 'qtop'"
|
\ a:buf =~# "unknown command 'qtop'"
|
||||||
let buf = ''
|
let buf = ''
|
||||||
elseif exists("b:mq") && b:mq isnot# buf
|
elseif exists("b:mq") && b:mq isnot# buf
|
||||||
@ -57,7 +57,7 @@ if v:version >= 800 && has("job")
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit_mq(channel) dict abort
|
function! s:on_exit_mq(channel) dict abort
|
||||||
call s:mq_output(self.buf, self.file)
|
call airline#async#mq_output(self.buf, self.file)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_exit_untracked(channel) dict abort
|
function! s:on_exit_untracked(channel) dict abort
|
||||||
@ -159,7 +159,7 @@ elseif has("nvim")
|
|||||||
|
|
||||||
function! s:nvim_mq_job_handler(job_id, data, event) dict
|
function! s:nvim_mq_job_handler(job_id, data, event) dict
|
||||||
if a:event == 'exit'
|
if a:event == 'exit'
|
||||||
call s:mq_output(self.buf, self.file)
|
call airline#async#mq_output(self.buf, self.file)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -124,21 +124,16 @@ function! s:update_hg_branch(...)
|
|||||||
if s:has_lawrencium
|
if s:has_lawrencium
|
||||||
let cmd='LC_ALL=C hg qtop'
|
let cmd='LC_ALL=C hg qtop'
|
||||||
let stl=lawrencium#statusline()
|
let stl=lawrencium#statusline()
|
||||||
|
let file=expand('%:p')
|
||||||
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
|
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
|
||||||
if g:airline#init#vim_async
|
if g:airline#init#vim_async
|
||||||
call airline#async#get_mq_async(cmd, expand('%:p'))
|
call airline#async#get_mq_async(cmd, file)
|
||||||
elseif has("nvim")
|
elseif has("nvim")
|
||||||
call airline#async#nvim_get_mq_async(cmd, expand('%:p'))
|
call airline#async#nvim_get_mq_async(cmd, file)
|
||||||
else
|
else
|
||||||
" remove \n at the end of the command
|
" remove \n at the end of the command
|
||||||
let output=system(cmd)[0:-2]
|
let output=system(cmd)[0:-2]
|
||||||
if output is# 'no patches applied ' ||
|
call airline#async#mq_output(output, file)
|
||||||
\ output =~# "unknown command 'qtop'"
|
|
||||||
let b:mq=''
|
|
||||||
else
|
|
||||||
unlet! b:airline_head
|
|
||||||
let b:mq = output
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
" do not do mq check anymore
|
" do not do mq check anymore
|
||||||
|
Loading…
Reference in New Issue
Block a user