mhinz / vim-signify

:heavy_plus_sign: Show a diff using Vim its sign column.
MIT License
2.7k stars 103 forks source link

I need to toggle several times to make signify working #217

Closed markwu closed 7 years ago

markwu commented 7 years ago

I use the master branch, and set signify disabled by default.

I just found I have to execute SignifyToggle several times to make siginify working. I really have no idea what's going on.

Would you kindly give me some hints let me do the debug and post useful information here to fix this bug.

My vim is macvim 8.0.302

mhinz commented 7 years ago

Unfortunately MacVim is broken at the moment: https://github.com/mhinz/vim-signify/issues/208

markwu commented 7 years ago

I just review the issue you reference to and also do some experiments, I think the problem is not the redrawing or rendering problem, it is maybe the job problem.

I try to use the older way inside sy#repor#get_diff_start for macvim, it seems fixed this issue.

I have no idea what's going, just a trial and error.

Here comes the difference:

diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim
index d1cba56..950e412 100644
--- a/autoload/sy/repo.vim
+++ b/autoload/sy/repo.vim
@@ -73,7 +73,7 @@ function! sy#repo#get_diff_start(vcs, do_register) abort
     endtry

   " Newer Vim
-  elseif v:version > 704 || v:version == 704 && has('patch1967')
+  elseif (v:version > 704 || v:version == 704 && has('patch1967')) && !has('gui_macvim')
     if job_id
       silent! call job_stop(job_id)
     endif
markwu commented 7 years ago

If you can confirm this bug, I think I could report this issue to macvim.

mhinz commented 7 years ago

Your diff simply forces the use of (synchronous) system() instead of using Vim 8's (asynchronous) job system. And I won't merge that, since it does work in Neovim, Vim 7, and Vim 8 with various GUIs.

It just doesn't work in MacVim and I can easily reproduce it with this:

sign define A text=AA texthl=WarningMsg
sign define B text=BB texthl=ErrorMsg

execute 'sign place 1 line=1 name=A file='. bufname('')

function! s:set_sign(_id, _exitval)
  execute 'sign place 2 line=2 name=B file='. bufname('')
endfunction

call job_start('sleep 1', { 'exit_cb': function('s:set_sign') })

When I run :so % in that file, AA in line 1 gets set right away, whereas I have to move the cursor before the BB in line 2 appears.

markwu commented 7 years ago

Sorry, I am not quite understand, I saw AA show up right away and I don't need to move my cursor the BB just show up after 1 second.

What is the expected behavior?

My Macvim is 8.0.324 OS is OSX 10.11.6

mhinz commented 7 years ago

Hmm, try with mvim -Nu NONE +'set guicursor=a:blinkoff0 updatetime=0'.

When there's nothing that updates the screen, BB doesn't automatically shows up after 1 second, but only when I move the cursor (which redraws the screen). I tested this with MacVim 8.0.297 from homebrew.

BTW, mvim -v should work as expected. It's only the GUI that triggers these kinds of bugs for me.


BTW, :SignifyToggle seems to work for me nevertheless (so it's not related to what I mentioned above). What are the exact steps you tried?

That being said, you could run mvim -V1 file-from-repo, then after starting run :SignifyToggle. Wait a bit, then check :messages. Could you paste the output? (Everything after [sy] Register new file.)