stable
Clone or download
part of request #29602 Migrate pullrequest file-diffs to TypeScript During the refactoring process, we ended up with a strange bug regarding line numbers provided by CodeMirror's gutterClick event. As a workaround, we decided to parse the line number contained in the gutter element provided by the event's target. However, It happened that this bug was also impacting the unified diff as well. Sadly, the same workaround cannot be used, as the unified diff's gutters display the same numbers for a group of added line and the opposite group of deleted lines. After a lot of investigation, it appears that since the rendering of file-diff widgets is kind of delayed (we don't rely on angular's $timeout anymore), we have to call widget.changed() in order to tell CodeMirror "Hey, be aware that the widget's height might be different, update the stuff you need". We now systematically call this method each time a widget re-renders, and it works fine as before. How to test: - Both in side-by-side and unified diff modes, and on different types of lines (added, removed, unmoved), click to add a new comment --> Each time the NewInlineCommentForm widget is added at the right place. --> No other functional change expected Change-Id: Icbbaf83c36e65de624212be26c00ba2f0f510053
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/FileDiffPlaceholder.ts | +10 | −3 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-mirror-widget-creator.test.ts | +33 | −12 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-mirror-widget-creator.ts | +22 | −8 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js | +4 | −10 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/types.ts | +1 | −0 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/unidiff-component.js | +6 | −2 | Go to diff View file |
M | plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts | +2 | −0 | Go to diff View file |