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

findAlignedLines sometimes returns unexpected results #669

Closed
HaudinFlorence opened this issue Sep 5, 2023 · 1 comment · Fixed by #706
Closed

findAlignedLines sometimes returns unexpected results #669

HaudinFlorence opened this issue Sep 5, 2023 · 1 comment · Fixed by #706

Comments

@HaudinFlorence
Copy link
Contributor

HaudinFlorence commented Sep 5, 2023

In some case it has been observed that the method findAlignedLinesused to determine which line numbers align with each other, in the set of DiffViews, return a non correct result, leading to wrong alignment.

We can see here an example of a mergeview:
Screenshot from 2023-09-05 23-40-52
The result given by findAlignedLinesis.
[3, 3, 3, 3]
[4, 5, 4, 5]
[11, 11, 11, 12]
[18, 18, 13, 14]
There is an additionnal padding in the left editor above line 12 causing that this line is not aligned with the 2 lines 11 of central and right editors.

After proposing this manual correction for the array return by findAlignedLines, alignment is fixed:
[3, 3, 3, 3]
[4, 5, 4, 5]
[11, 12 11, 12]
[18, 19, 13, 14]
Screenshot from 2023-09-06 00-15-44

@fcollonval
Copy link
Collaborator

That error is more specifically coming from

function getMatchingEditLineLC(toMatch: Chunk, chunks: Chunk[]): number {

it does not handle properly finding a chunk in an editor that does not have that chunk; e.g. if a chunk is between base and right editors, that method does not return the proper alignment for that chunk in the left editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants