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

Improve findAlignedLines #706

Merged
merged 4 commits into from
Oct 12, 2023
Merged

Conversation

fcollonval
Copy link
Collaborator

@fcollonval fcollonval commented Oct 11, 2023

Fixes #669

Compute correctly the alignment for a chunk in another diff view.

Before

image

After

image

@fcollonval fcollonval added the bug label Oct 11, 2023
@fcollonval
Copy link
Collaborator Author

bot please update playwright snapshots

@fcollonval fcollonval marked this pull request as ready for review October 11, 2023 14:26
@github-actions
Copy link
Contributor

Playwright windows-latest snapshots updated.

@HaudinFlorence
Copy link
Contributor

@fcollonval thanks for this PR. I have tried it on a case that was not producing correct results (the case reported in issue #669 that is close to the one present in this PR) and it seems to work.

@fcollonval fcollonval closed this Oct 12, 2023
@fcollonval fcollonval reopened this Oct 12, 2023
@fcollonval fcollonval merged commit 22a5846 into jupyter:master Oct 12, 2023
13 checks passed
@fcollonval fcollonval deleted the fix/align-chunk branch October 12, 2023 14:39
? this._base.cm.defaultLineHeight
: this._diffViews[0].remoteEditorWidget.cm.defaultLineHeight;
if (this._aligning) {
return;
}
this._aligning = true;
// Find matching lines
let linesToAlign = findAlignedLines(this._diffViews);
const linesToAlign = findAlignedLines(this._diffViews);
console.log(linesToAlign)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug log statement left behind

break;
}
}
return toMatch.baseTo;
// toMatch is not in chunks list, add lines delta from the last chunk
console.log(previous, toMatch.baseTo + (previous ? (previous.remoteTo - previous.baseTo) : 0))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug log statement left behind

@@ -1179,17 +1179,26 @@ function getMatchingEditLine(baseLine: number, chunks: Chunk[]): number {
*
*/
function getMatchingEditLineLC(toMatch: Chunk, chunks: Chunk[]): number {
let editLine = toMatch.baseFrom;
console.log(toMatch, chunks)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log statement

fcollonval added a commit to fcollonval/nbdime that referenced this pull request Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

findAlignedLines sometimes returns unexpected results
3 participants