Vim: Crash when you switch branches (if the difference is large enough)

Created on 26 Jul 2016  路  7Comments  路  Source: VSCodeVim/Vim

This is because we do a diff in HistoryTracker and jsdiff has a run time of something like O(n^2).

Should be as simple as adding a 1 second timeout to the differ and, if we hit the timeout, (somehow) stopping the diff and just saying we deleted and recreated the entire document.

help wanted sizM

All 7 comments

I might even go as far as to say that the history _should_ be reset when you switch branches. A couple times I've accidentally hit u after switching branches and it tried reverting the whole document.

The only problem is that differentiating between switching branches and the file being edited by another process is difficult to impossible. Maybe this difference is not big enough to worry about.

@infogulch Good point. I am fine with totally resetting history in a case like this.

I suppose it鈥檚 not just branch switching, when you do reverting in Git, it will fail sometimes, right?

Yes. Branch switching is the easiest way to trigger this change that I've found, however anything that causes the history tracker to do a massive diff will trigger it. Pasting tons of text, changing the file in another editor, git revert, etc.

Looking forward to see this get fixed as I'm working on several branches with massive diff (hundreds of lines) and run into this issue constantly :)

Ahh, yeah, that doesn't sound enjoyable.

Fortunately, this is not a hard fix at all. I should be able to get it done in the next few days.

Closing in favor of #558.

Also, famous last words. This fix is not simple at all. :P

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jimmy-Z picture Jimmy-Z  路  3Comments

orn688 picture orn688  路  3Comments

edwintorok picture edwintorok  路  3Comments

WangRongda picture WangRongda  路  3Comments

AndersenJ picture AndersenJ  路  3Comments