Community
Participate
Working Groups
I happened to find this rare case while testing today. 1.Search on key word "new". 2.In the result page, go to ptions->"sort by name" then click on replace and enter "becomeOld". 3.In the preview page, click on annotations.js and expand it. 4.Click on the second match. In the compare view you will see the changed match is properly highlighted as a pair but the diff block is annotated one line below that. Not sure if jsDiff is wrong or I am wrong but need investigation for M2.
Created attachment 210084 [details] Screen shot
fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8ea6c50c1ab37d056be007e4c356417938ee2e84. Basically the jsDiffAdapter.js assumed that all diff blocks returned by jsdiff.diffLines are the following pattern: unchanged block (foo\n) added block or nothing(bar\n) removed block or nothing(coo\n) unchanged block (fooo\n) added block or nothing(baar\n) removed block or nothing(cooo\n) But sometimes it returns something like this unchanged block (foo\n) added block or nothing(bar) removed block or nothing(coo) unchanged block (\nfooo\n) added block or nothing(baar) removed block or nothing(cooo) We should be careful on counting the unchanged block length because at very beginning it may contain a line delimeter that is supposed to be contained in the previous added/removed block.