yalay / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Diff mode gets stuck #336

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Unfortunately I haven't discovered an easy way to reproduce this.

1. open two similar files (call them A and B) in split windows
2. windo diffthis
3. navigate away from B using bufexplorer, netrw and other plugins, opening and 
closing windows etc.
4. switch back to buffer B

It sometimes happens that in step 4 I get to see buffer B without diff 
highlighting.  At that point I can switch to the window displaying buffer A, 
:diffoff, close all other windows with :only, attempt a big hamer like  :bufdo 
diffoff, and yet if I'll open an unrelated file C and try to :diffthis, vim 
will begin diffing it with B.

The only way to make vim forget it was ever diffing with B that I discovered is 
to open a new tab page and close the old tab page.

I'm using vim 7.4.617 on Linux.

Original issue reported on code.google.com by mged...@gmail.com on 5 Mar 2015 at 11:14

GoogleCodeExporter commented 9 years ago
Well, it's a bit hard to understand the problem, but if I understand correctly, 
this can happen because if you open buffer a in a new window, 'diff' mode will 
be off, because it is a window-local option (this is explained briefly at :h 
option-summary).
So this works as expected, closing.

Original comment by chrisbr...@googlemail.com on 24 Mar 2015 at 6:35

GoogleCodeExporter commented 9 years ago
I apologize for not explaining clearly enough.  The problem is that I can't 
diff anything else in that vim tab -- it will always try to diff the new files 
against one of the two original files!

I can't find the right buffer/window combination to :diffoff -- attempts to do 
:bufdo diffoff or :windo diffoff, or closing all the windows don't help.

The only way I can use diff again is to open a new :tab and close the old one, 
since diff status is tied to tabs.

AFAICT the internal list of diffable-buffers gets out of sync with the 
window-local 'diff' options somehow, making it impossible to remove the diff 
mode that got stuck.

Original comment by mged...@gmail.com on 24 Mar 2015 at 6:51

GoogleCodeExporter commented 9 years ago
I still think, this works as expected, there can only be 4 buffers in diff mode.
A :diffoff! should work, however.

Original comment by chrisbr...@googlemail.com on 24 Mar 2015 at 6:56

GoogleCodeExporter commented 9 years ago
Wow.  How did I not know about :diffoff!?  I'll be sure to try it the next time 
this happens to me.

Original comment by mged...@gmail.com on 24 Mar 2015 at 7:38