diff options
author | Ole Rehmsen <oler@google.com> | 2019-07-25 07:44:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-07-25 07:44:11 +0000 |
commit | e47e441d928ceb71fca6a5eae4f9280e0202c557 (patch) | |
tree | 8a2004c49c6d3934046f59989a569b5b89558290 | |
parent | 4be16490814a87d96bd04282abae2edee4105122 (diff) | |
parent | 2374b6b18418ca7b5c6b4aa26031ef00bda025c7 (diff) |
Merge "Interpret empty DiffIntralineInfo list as marked"
-rw-r--r-- | Documentation/rest-api-changes.txt | 13 | ||||
-rw-r--r-- | polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js | 3 | ||||
-rw-r--r-- | polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html | 4 |
3 files changed, 15 insertions, 5 deletions
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt index d0d77a4a50..15f59c16a2 100644 --- a/Documentation/rest-api-changes.txt +++ b/Documentation/rest-api-changes.txt @@ -6253,10 +6253,12 @@ in a file. |`a` |optional|Content only in the file on side A (deleted in B). |`b` |optional|Content only in the file on side B (added in B). |`ab` |optional|Content in the file on both sides (unchanged). -|`edit_a` |only present during a replace, i.e. both `a` and `b` are present| +|`edit_a` |only present when the `intraline` parameter is set and the +DiffContent is a replace, i.e. both `a` and `b` are present| Text sections deleted from side A as a link:#diff-intraline-info[DiffIntralineInfo] entity. -|`edit_b` |only present during a replace, i.e. both `a` and `b` are present| +|`edit_b` |only present when the `intraline` parameter is set and the +DiffContent is a replace, i.e. both `a` and `b` are present| Text sections inserted in side B as a link:#diff-intraline-info[DiffIntralineInfo] entity. |`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a @@ -6319,11 +6321,12 @@ link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries. The `DiffIntralineInfo` entity contains information about intraline edits in a file. -The information consists of a list of `<skip length, mark length>` pairs, where +The information consists of a list of `<skip length, edit length>` pairs, where the skip length is the number of characters between the end of the previous edit -and the start of this edit, and the mark length is the number of edited characters +and the start of this edit, and the edit length is the number of edited characters following the skip. The start of the edits is from the beginning of the related -diff content lines. +diff content lines. If the list is empty, the entire DiffContent should be +considered edited. Note that the implied newline character at the end of each line is included in the length calculation, and thus it is possible for the edits to span newlines. diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js index 5874187baa..5ddf97a8bc 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js @@ -332,6 +332,9 @@ if (line.type !== GrDiffLine.Type.BLANK) { td.classList.add('content'); } + if (line.highlights.length === 0) { + td.classList.add('no-highlights'); + } td.classList.add(line.type); const lineLimit = diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html index 6ac671471d..06f8a4fbe1 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html @@ -130,6 +130,8 @@ limitations under the License. width: var(--content-width, 80ch); } .content.add .intraline, + /* If there are no intraline changes, consider everything changed */ + .content.add.no-highlights, .delta.total .content.add { background-color: var(--dark-add-highlight-color); } @@ -137,6 +139,8 @@ limitations under the License. background-color: var(--light-add-highlight-color); } .content.remove .intraline, + /* If there are no intraline changes, consider everything changed */ + .content.remove.no-highlights, .delta.total .content.remove { background-color: var(--dark-remove-highlight-color); } |