tomtom / quickfixsigns_vim

Mark quickfix & location list items with signs
http://www.vim.org/scripts/script.php?script_id=2584
GNU General Public License v3.0
131 stars 13 forks source link

Accuracy of vcs diff markers/signs deteriorates over time #10

Closed majutsushi closed 13 years ago

majutsushi commented 13 years ago

I've noticed a strange behaviour of the signs that indicate changes relative to the vcs state (i.e. the +/-/= markers). When I start vim and load a file that has some uncommitted changes the signs are correct, but the more I keep editing the file (and writing it) the less accurate the signs become: added lines don't get a + sign, other signs are shown on the wrong line etc. Quitting Vim and loading the file again fixes this, but it's a bit annoying having no reliable signs while editing.

majutsushi commented 13 years ago

Just in case it matters, this happens with git, I haven't tried any other VCSs yet to check whether it's the same there.

tomtom commented 13 years ago

The signs are set on BufEnter and BufferWritePost events. Saving the buffer should thus update the signs. Keeping the signs up to date while editing (e.g. on CursorHold events) would require optimizations in quickfixsigns#vcsdiff#GetList().

majutsushi commented 13 years ago

Yes, I'm aware that the signs are only updated on those two events. The point is that when these updates happen they don't seem to be done correctly. A simple way to reliably reproduce it for me is this:

  1. Open a (so far unchanged) version-controlled file.
  2. Add a few new lines somewhere.
  3. Save the file. The signs are updated and correctly show the new lines as added.
  4. Go to the middle of the new lines and add a few more lines there.
  5. Save the file. The signs are updated, and the lines that were added in step 2 still have their correct + sign, but the lines added in step 4 don't have any signs, even though they too should have received them on save.

This also doesn't change if I save the file again or make more changes somewhere and save, the lines added in step 4 will never receive the correct signs. Only doing a :bwipeout (or restarting Vim) will make the signs appear correctly.