blob: Fix missing blame decoration (#58129)

The hunks should be compared by identity, not revision. I think I was
exploring comparing by revision in order to avoid showing the same
decoration for consecutive hunks, but that had other UI issues.
This commit is contained in:
Felix Kling 2023-11-06 20:25:46 +01:00 committed by GitHub
parent baa50d7455
commit 1fe96cf934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,7 @@ class BlameDecorationViewPlugin implements PluginValue {
const builder = new RangeSetBuilder<Decoration>()
// Keeps track of the last found hunk. We don't want to show an additional blame
// decoration when a range inside a single hunk is shown.
// decoration when a range inside a single hunk is folded.
let previousHunk: BlameHunk | undefined
for (const { from, to } of view.visibleRanges) {
@ -188,7 +188,7 @@ class BlameDecorationViewPlugin implements PluginValue {
const endLine = view.state.doc.lineAt(to).number
while (line.number <= endLine) {
const matchingHunk = lines[line.number]
if (matchingHunk && matchingHunk.rev !== previousHunk?.rev) {
if (matchingHunk && matchingHunk !== previousHunk) {
if (line.number !== 1) {
builder.add(line.from, line.from, startOfHunkDecoration)
}