# HG changeset patch # User Ludovic Chabant # Date 1392600678 28800 # Node ID a987094d5ae6170eee94556d3cf38319fdeee280 # Parent 1fbba48019b5db1fac3a2bbb627e37040d24210f Made the `Hgstatus` window refresh itself when needed. diff -r 1fbba48019b5 -r a987094d5ae6 plugin/lawrencium.vim --- a/plugin/lawrencium.vim Sun Feb 16 16:00:16 2014 -0800 +++ b/plugin/lawrencium.vim Sun Feb 16 17:31:18 2014 -0800 @@ -895,10 +895,16 @@ endif endfunction -function! s:HgStatus_Refresh() abort - " Just re-edit the buffer, it will reload the contents by calling - " the matching Mercurial command. - edit +function! s:HgStatus_Refresh(...) abort + if a:0 == 0 + " Just re-edit the buffer, it will reload the contents by calling + " the matching Mercurial command. + edit + else + " Re-edit the given buffer. + execute 'buf ' . a:1 + edit + endif endfunction function! s:HgStatus_FileEdit() abort @@ -943,8 +949,16 @@ return endif + " Remember which buffer this is. + let l:status_nr = bufnr('%') + " Run `Hgcommit` on those paths. call s:HgCommit(a:bang, a:vertical, l:filenames) + + " At this point we should be in the commit message buffer. + " Let's refresh the status window when that buffer gets deleted. + let l:bufobj = s:buffer_obj() + call l:bufobj.OnDelete('call s:HgStatus_Refresh(' . l:status_nr . ')') endfunction function! s:HgStatus_Diff(vertical) abort @@ -981,6 +995,9 @@ call insert(l:filenames, l:message, 1) endif call l:repo.RunCommand('qnew', l:filenames) + + " Refresh the status window. + call s:HgStatus_Refresh() endfunction function! s:HgStatus_QRefresh(linestart, lineend) abort @@ -995,6 +1012,9 @@ let l:repo = s:hg_repo() call insert(l:filenames, '-s', 0) call l:repo.RunCommand('qrefresh', l:filenames) + + " Refresh the status window. + call s:HgStatus_Refresh() endfunction