|
|
|
|
|
by alexdima
3651 days ago
|
|
We don't show leading/trailing whitespace diffs unless the diff consists only of leading/trailing whitespace changes. This is sort of what we do when diffing: * when we need to compare two buffers, we represent them as two arrays of lines * we then proceed to trim() each line in both arrays * we then use a greedy optimization where the first N and the last M lines that are equal (post trimming) in both arrays are dropped from further computation * we then run a LCS algorithm over the remaining lines to find the diffs It is important to note that the same two arrays of lines can have multiple equal longest common substrings. This method [1] could get some love and could try to recover in some of these cases. [1] https://github.com/Microsoft/vscode/blob/5b9ec15ce526decc5dd... |
|