Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird diff result #42751

Closed
alexdima opened this issue Feb 1, 2018 · 3 comments
Closed

Weird diff result #42751

alexdima opened this issue Feb 1, 2018 · 3 comments
Assignees
Labels
*as-designed Described behavior is as designed bug Issue identified by VS Code Team member as probable bug diff-editor Diff editor mode issues
Milestone

Comments

@alexdima
Copy link
Member

alexdima commented Feb 1, 2018

Extracted from #9012 (comment)

@alexandrudima Not sure if it is expected, why does the additional space in the second line in the following diff is not highlighted

image

@alexdima alexdima self-assigned this Feb 1, 2018
@alexdima alexdima added the diff-editor Diff editor mode issues label Feb 1, 2018
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Feb 5, 2018
@alexdima alexdima added this to the On Deck milestone Feb 5, 2018
@alexdima alexdima modified the milestones: On Deck, May 2018 May 3, 2018
@sbatten
Copy link
Member

sbatten commented May 31, 2018

When verifying, I found this case where the fourth line claims it preserves some spaces on the left but are all highlighted on the right.

image

@sbatten sbatten reopened this May 31, 2018
@alexdima
Copy link
Member Author

Here is a Copy-Paste friendly version of the screenshot above

   farst line
sacond line   
thard line
   faurth   line   
first line   
   second    line
third line   
      fourth     line     

The diff algorithm matches the 3 spaces on original line 4 with the spaces on modified line 3. i.e.

screen shot 2018-05-31 at 09 53 17


This is expected, as the character level diffing runs on multiple lines. Here is a clearer example:

hello my dear world
hello my 
lovely world

IMHO this is a good thing, as it allows me to see that "dear" was replaced with "lovely" and a newline was added

screen shot 2018-05-31 at 09 58 25

@sbatten
Copy link
Member

sbatten commented May 31, 2018

thanks for the explanation. I agree, I just missed the transferring of spaces and thought there could be a deeper issue.

@RMacfarlane RMacfarlane added the *as-designed Described behavior is as designed label May 31, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed bug Issue identified by VS Code Team member as probable bug diff-editor Diff editor mode issues
Projects
None yet
Development

No branches or pull requests

3 participants