Skip to content

Commit 5aaa8da

Browse files
authored
Merge pull request #3841 from Tyriar/3840
Allow up to double the size for overview ruler decorations
2 parents 1980f67 + 7a652c4 commit 5aaa8da

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/browser/decorations/OverviewRulerRenderer.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export class OverviewRulerRenderer extends Disposable {
8888
}));
8989
this.register(this._bufferService.onScroll(() => {
9090
if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {
91+
this._refreshDrawHeightConstants();
9192
this._refreshColorZonePadding();
9293
}
9394
}));
@@ -132,17 +133,25 @@ export class OverviewRulerRenderer extends Disposable {
132133
drawWidth.center = innerWidth;
133134
drawWidth.right = outerWidth;
134135
// height
135-
drawHeight.full = Math.round(2 * window.devicePixelRatio);
136-
drawHeight.left = Math.round(6 * window.devicePixelRatio);
137-
drawHeight.center = Math.round(6 * window.devicePixelRatio);
138-
drawHeight.right = Math.round(6 * window.devicePixelRatio);
136+
this._refreshDrawHeightConstants();
139137
// x
140138
drawX.full = 0;
141139
drawX.left = 0;
142140
drawX.center = drawWidth.left;
143141
drawX.right = drawWidth.left + drawWidth.center;
144142
}
145143

144+
private _refreshDrawHeightConstants(): void {
145+
drawHeight.full = Math.round(2 * window.devicePixelRatio);
146+
// Calculate actual pixels per line
147+
const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;
148+
// Clamp actual pixels within a range
149+
const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * window.devicePixelRatio);
150+
drawHeight.left = nonFullHeight;
151+
drawHeight.center = nonFullHeight;
152+
drawHeight.right = nonFullHeight;
153+
}
154+
146155
private _refreshColorZonePadding(): void {
147156
this._colorZoneStore.setPadding({
148157
full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),

0 commit comments

Comments
 (0)