microsoft / vscode

Visual Studio Code

Home Page:https://code.visualstudio.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Diff algorithm detects two consecutive added lines as two changes (instead of one)

bersbersbers opened this issue · comments

  • VS Code Version: 1.54.3
  • OS Version: Windows 10, SSH to Linux

Steps to Reproduce:

  1. bug1.txt:
1


2

  1. bug2.txt:
1

1.5


2

3

  1. Compare selected

Result:
image

This diff is not wrong, but it's not minimal. The first two changes could be merged into one, just like diff does it:

> diff bug1.txt bug2.txt 
2a3,4
> 1.5
> 
4a7,8
> 
> 3

Interestingly, removing the final line break from bug2.txt prevents the issue:
image

Does this issue occur when all extensions are disabled?: Yes

Thanks!