author fix
This commit is contained in:
@@ -63,12 +63,26 @@ function renderGutter() {
|
|||||||
const top = paddingTop - editor.scrollTop;
|
const top = paddingTop - editor.scrollTop;
|
||||||
ownerLabels.innerHTML = `<span class="owner-label-group" style="top:${top}px"><span class="owner-label" style="--owner:${colorFor(owner)}">${escapeHtml(ownerName(owner))}</span></span>`;
|
ownerLabels.innerHTML = `<span class="owner-label-group" style="top:${top}px"><span class="owner-label" style="--owner:${colorFor(owner)}">${escapeHtml(ownerName(owner))}</span></span>`;
|
||||||
} else {
|
} else {
|
||||||
|
let previousAuthorSignature = null;
|
||||||
ownerLabels.innerHTML = lines.map((_, i) => {
|
ownerLabels.innerHTML = lines.map((_, i) => {
|
||||||
const authors = authorsByLine[i] || [];
|
const authors = authorsByLine[i] || [];
|
||||||
if (!authors.length) return "";
|
if (!authors.length) return "";
|
||||||
|
|
||||||
const top = paddingTop + i * lineHeight - editor.scrollTop;
|
const top = paddingTop + i * lineHeight - editor.scrollTop;
|
||||||
const badges = authors.map(owner => `<span class="owner-label" style="--owner:${colorFor(owner)}">${escapeHtml(ownerName(owner))}</span>`).join("");
|
const signature = authors
|
||||||
return `<span class="owner-line" style="top:${top}px;--owner:${colorFor(authors[0])}"></span><span class="owner-label-group" style="top:${top}px">${badges}</span>`;
|
.map(owner => ownerName(owner))
|
||||||
|
.sort((a, b) => a.localeCompare(b))
|
||||||
|
.join("\u0000");
|
||||||
|
const startsOwnershipBlock = signature !== previousAuthorSignature;
|
||||||
|
previousAuthorSignature = signature;
|
||||||
|
|
||||||
|
const lineMarker = `<span class="owner-line" style="top:${top}px;--owner:${colorFor(authors[0])}"></span>`;
|
||||||
|
if (!startsOwnershipBlock) return lineMarker;
|
||||||
|
|
||||||
|
const badges = authors
|
||||||
|
.map(owner => `<span class="owner-label" style="--owner:${colorFor(owner)}">${escapeHtml(ownerName(owner))}</span>`)
|
||||||
|
.join("");
|
||||||
|
return `${lineMarker}<span class="owner-label-group" style="top:${top}px">${badges}</span>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
}
|
}
|
||||||
if (showAuthorship) renderAuthorshipLayer(authorshipLayer, editor, authorship, colorFor);
|
if (showAuthorship) renderAuthorshipLayer(authorshipLayer, editor, authorship, colorFor);
|
||||||
|
|||||||
Reference in New Issue
Block a user