Use a per-file width for the line number gutter. (#6959)

In in the VSCode extension, use the same width for the per-split line
number gutter across all splits. This makes the visuals more consistent.
This commit is contained in:
Richard Smith
2026-03-24 21:55:48 +00:00
committed by GitHub
parent 29a8b315d3
commit 7345f4e860
+14 -3
View File
@@ -50,6 +50,20 @@ function updateSplitLineNumbers(editor: TextEditor | undefined) {
}
}
// Find the maximum split length to ensure consistent width across all splits
let maxSplitLength = 0;
for (let s = 0; s < splitStarts.length; s++) {
const startLine = splitStarts[s];
const endLine = s + 1 < splitStarts.length ? splitStarts[s + 1] : document.lineCount;
const splitLength = endLine - startLine - 1;
if (splitLength > maxSplitLength) {
maxSplitLength = splitLength;
}
}
const maxDigits = maxSplitLength > 0 ? maxSplitLength.toString().length : 1;
const widthStr = `${maxDigits}ch`;
// Iterate through each split
for (let s = 0; s < splitStarts.length; s++) {
const startLine = splitStarts[s];
@@ -59,9 +73,6 @@ function updateSplitLineNumbers(editor: TextEditor | undefined) {
continue;
}
const maxDigits = splitLength.toString().length;
const widthStr = `${maxDigits}ch`;
for (let i = startLine + 1; i < endLine; i++) {
const splitLineNum = i - startLine;
decorations.push({