monaco-editor-core 0.58.0-dev-20261107 → 0.58.0-dev-20261109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.58.0-dev-20261107(5359a3330383137dfdf8897ba1d93d943fec4027)
3
+ * Version: 0.58.0-dev-20261109(5359a3330383137dfdf8897ba1d93d943fec4027)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -8,7 +8,8 @@
8
8
  opacity: 0;
9
9
  transition: opacity 100ms linear;
10
10
  }
11
- .monaco-editor .minimap.slider-mouseover:hover .minimap-slider {
11
+ .monaco-editor .minimap.slider-mouseover:hover .minimap-slider,
12
+ .monaco-editor .minimap.slider-mouseover.slider-scrolling .minimap-slider {
12
13
  opacity: 1;
13
14
  }
14
15
  .monaco-editor .minimap.slider-mouseover .minimap-slider.active {
@@ -49,7 +50,7 @@
49
50
  opacity: 0;
50
51
  transition: opacity 0.5s;
51
52
  }
52
- .minimap.minimap-autohide-scroll{
53
+ .minimap.minimap-autohide-scroll {
53
54
  pointer-events: none;
54
55
  }
55
56
  .minimap.minimap-autohide-mouseover:hover,
@@ -65,7 +66,3 @@
65
66
  */
66
67
  z-index: 4;
67
68
  }
68
-
69
- .monaco-editor .minimap canvas {
70
- opacity: 0.9;
71
- }
@@ -19,6 +19,7 @@ import { minimapSelection, minimapBackground, minimapForegroundOpacity, editorFo
19
19
  import { Selection } from '../../../common/core/selection.js';
20
20
  import { EventType, Gesture } from '../../../../base/browser/touch.js';
21
21
  import { MinimapCharRendererFactory } from './minimapCharRendererFactory.js';
22
+ import { RecordedFrame, RowSignatures } from './minimapDirtyRows.js';
22
23
  import { createSingleCallFunction } from '../../../../base/common/functional.js';
23
24
  import { LRUCache } from '../../../../base/common/map.js';
24
25
  import { DEFAULT_FONT_FAMILY } from '../../../../base/browser/fonts.js';
@@ -116,12 +117,13 @@ class MinimapOptions {
116
117
  && this.minimapCharWidth === other.minimapCharWidth
117
118
  && this.sectionHeaderFontSize === other.sectionHeaderFontSize
118
119
  && this.sectionHeaderLetterSpacing === other.sectionHeaderLetterSpacing
120
+ && this.sectionHeaderFontColor.equals(other.sectionHeaderFontColor)
119
121
  && this.defaultBackgroundColor && this.defaultBackgroundColor.equals(other.defaultBackgroundColor)
120
122
  && this.backgroundColor && this.backgroundColor.equals(other.backgroundColor)
121
123
  && this.foregroundAlpha === other.foregroundAlpha);
122
124
  }
123
125
  }
124
- class MinimapLayout {
126
+ export class MinimapLayout {
125
127
  constructor(
126
128
  /**
127
129
  * The given editor scrollTop (input).
@@ -188,7 +190,7 @@ class MinimapLayout {
188
190
  getYForLineNumber(lineNumber, minimapLineHeight) {
189
191
  return +(lineNumber - this.startLineNumber + this.topPaddingLineCount) * minimapLineHeight;
190
192
  }
191
- static create(options, viewportStartLineNumber, viewportEndLineNumber, viewportStartLineNumberVerticalOffset, viewportHeight, viewportContainsWhitespaceGaps, lineCount, realLineCount, scrollTop, scrollHeight, previousLayout) {
193
+ static create(options, viewportStartLineNumber, viewportEndLineNumber, viewportStartLineNumberVerticalOffset, viewportStartLineNumberLineHeight, viewportHeight, viewportContainsWhitespaceGaps, lineCount, realLineCount, scrollTop, scrollHeight, previousLayout) {
192
194
  const pixelRatio = options.pixelRatio;
193
195
  const minimapLineHeight = options.minimapLineHeight;
194
196
  const minimapLinesFitting = Math.floor(options.canvasInnerHeight / minimapLineHeight);
@@ -291,7 +293,12 @@ class MinimapLayout {
291
293
  }
292
294
  }
293
295
  const endLineNumber = Math.min(lineCount, startLineNumber - topPaddingLineCount + minimapLinesFitting - 1);
294
- const partialLine = (scrollTop - viewportStartLineNumberVerticalOffset) / lineHeight;
296
+ // When the viewport starts inside a view zone, the top padding or a taller line, the first
297
+ // visible line does not start at `scrollTop`; clamp so the slider never moves backwards.
298
+ // A custom line height can round to 0px, and such a line has no partial progress
299
+ const partialLine = viewportStartLineNumberLineHeight > 0
300
+ ? Math.min(Math.max(0, scrollTop - viewportStartLineNumberVerticalOffset), viewportStartLineNumberLineHeight) / viewportStartLineNumberLineHeight
301
+ : 0;
295
302
  let sliderTopAligned;
296
303
  if (scrollTop >= options.paddingTop) {
297
304
  sliderTopAligned = (viewportStartLineNumber - startLineNumber + topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
@@ -744,6 +751,7 @@ export class Minimap extends ViewPart {
744
751
  viewportStartLineNumber: viewportStartLineNumber,
745
752
  viewportEndLineNumber: viewportEndLineNumber,
746
753
  viewportStartLineNumberVerticalOffset: ctx.getVerticalOffsetForLineNumber(viewportStartLineNumber),
754
+ viewportStartLineNumberLineHeight: ctx.getLineHeightForLineNumber(viewportStartLineNumber),
747
755
  scrollTop: ctx.scrollTop,
748
756
  scrollLeft: ctx.scrollLeft,
749
757
  viewportWidth: ctx.viewportWidth,
@@ -892,6 +900,11 @@ export class Minimap extends ViewPart {
892
900
  class InnerMinimap extends Disposable {
893
901
  constructor(theme, model) {
894
902
  super();
903
+ /**
904
+ * What each row of `_decorationsCanvas` shows, so that the next frame only redraws
905
+ * the rows that change. Drawing on all of a visible canvas makes the browser repaint all of it.
906
+ */
907
+ this._lastDecorationsRows = null;
895
908
  this._renderDecorations = false;
896
909
  this._gestureInProgress = false;
897
910
  this._isMouseOverMinimap = false;
@@ -930,6 +943,7 @@ class InnerMinimap extends Disposable {
930
943
  this._slider.appendChild(this._sliderHorizontal);
931
944
  this._applyLayout();
932
945
  this._hideDelayedScheduler = this._register(new RunOnceScheduler(() => this._hideImmediatelyIfMouseIsOutside(), 500));
946
+ this._hideSliderAfterScrollScheduler = this._register(new RunOnceScheduler(() => this._domNode.toggleClassName('slider-scrolling', false), 500));
933
947
  this._register(dom.addStandardDisposableListener(this._domNode.domNode, dom.EventType.MOUSE_OVER, () => {
934
948
  this._isMouseOverMinimap = true;
935
949
  }));
@@ -1086,6 +1100,7 @@ class InnerMinimap extends Disposable {
1086
1100
  this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight);
1087
1101
  this._decorationsCanvas.domNode.width = this._model.options.canvasInnerWidth;
1088
1102
  this._decorationsCanvas.domNode.height = this._model.options.canvasInnerHeight;
1103
+ this._lastDecorationsRows = null;
1089
1104
  this._slider.setWidth(this._model.options.minimapWidth);
1090
1105
  }
1091
1106
  _getBuffer() {
@@ -1134,6 +1149,10 @@ class InnerMinimap extends Disposable {
1134
1149
  this._domNode.toggleClassName('active', true);
1135
1150
  this._hideSoon();
1136
1151
  }
1152
+ if (this._model.options.showSlider === 'mouseover' && e.scrollTopChanged) {
1153
+ this._domNode.toggleClassName('slider-scrolling', true);
1154
+ this._hideSliderAfterScrollScheduler.schedule();
1155
+ }
1137
1156
  this._renderDecorations = true;
1138
1157
  return true;
1139
1158
  }
@@ -1172,7 +1191,7 @@ class InnerMinimap extends Disposable {
1172
1191
  else {
1173
1192
  this._shadow.setClassName('minimap-shadow-visible');
1174
1193
  }
1175
- const layout = MinimapLayout.create(this._model.options, renderingCtx.viewportStartLineNumber, renderingCtx.viewportEndLineNumber, renderingCtx.viewportStartLineNumberVerticalOffset, renderingCtx.viewportHeight, renderingCtx.viewportContainsWhitespaceGaps, this._model.getLineCount(), this._model.getRealLineCount(), renderingCtx.scrollTop, renderingCtx.scrollHeight, this._lastRenderData ? this._lastRenderData.renderedLayout : null);
1194
+ const layout = MinimapLayout.create(this._model.options, renderingCtx.viewportStartLineNumber, renderingCtx.viewportEndLineNumber, renderingCtx.viewportStartLineNumberVerticalOffset, renderingCtx.viewportStartLineNumberLineHeight, renderingCtx.viewportHeight, renderingCtx.viewportContainsWhitespaceGaps, this._model.getLineCount(), this._model.getRealLineCount(), renderingCtx.scrollTop, renderingCtx.scrollHeight, this._lastRenderData ? this._lastRenderData.renderedLayout : null);
1176
1195
  this._slider.setDisplay(layout.sliderNeeded ? 'block' : 'none');
1177
1196
  this._slider.setTop(layout.sliderTop);
1178
1197
  this._slider.setHeight(layout.sliderHeight);
@@ -1195,26 +1214,41 @@ class InnerMinimap extends Disposable {
1195
1214
  const minimapLineHeight = this._model.options.minimapLineHeight;
1196
1215
  const minimapCharWidth = this._model.options.minimapCharWidth;
1197
1216
  const tabSize = this._model.getOptions().tabSize;
1217
+ if (canvasInnerWidth === 0 || canvasInnerHeight === 0) {
1218
+ return;
1219
+ }
1198
1220
  const canvasContext = this._decorationsCanvas.domNode.getContext('2d');
1199
- canvasContext.clearRect(0, 0, canvasInnerWidth, canvasInnerHeight);
1221
+ const frame = new RecordedFrame(canvasInnerHeight);
1200
1222
  // We first need to render line highlights and then render decorations on top of those.
1201
1223
  // But we need to pick a single color for each line, and use that as a line highlight.
1202
1224
  // This needs to be the color of the decoration with the highest `zIndex`, but priority
1203
1225
  // is given to the selection.
1204
1226
  const highlightedLines = new ContiguousLineMap(layout.startLineNumber, layout.endLineNumber, false);
1205
- this._renderSelectionLineHighlights(canvasContext, selections, highlightedLines, layout, minimapLineHeight);
1206
- this._renderDecorationsLineHighlights(canvasContext, decorations, highlightedLines, layout, minimapLineHeight);
1227
+ this._renderSelectionLineHighlights(frame, selections, highlightedLines, layout, minimapLineHeight, canvasInnerWidth);
1228
+ this._renderDecorationsLineHighlights(frame, decorations, highlightedLines, layout, minimapLineHeight, canvasInnerWidth);
1207
1229
  const lineOffsetMap = new ContiguousLineMap(layout.startLineNumber, layout.endLineNumber, null);
1208
- this._renderSelectionsHighlights(canvasContext, selections, lineOffsetMap, layout, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
1209
- this._renderDecorationsHighlights(canvasContext, decorations, lineOffsetMap, layout, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
1210
- this._renderSectionHeaders(layout);
1211
- }
1212
- }
1213
- _renderSelectionLineHighlights(canvasContext, selections, highlightedLines, layout, minimapLineHeight) {
1230
+ this._renderSelectionsHighlights(frame, selections, lineOffsetMap, layout, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
1231
+ this._renderDecorationsHighlights(frame, decorations, lineOffsetMap, layout, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
1232
+ this._renderSectionHeaders(frame, canvasContext, layout);
1233
+ // Only redraw the rows that look different from the last frame
1234
+ const dirty = RowSignatures.diff(this._lastDecorationsRows, frame.rows);
1235
+ this._lastDecorationsRows = frame.rows;
1236
+ if (dirty) {
1237
+ canvasContext.save();
1238
+ canvasContext.beginPath();
1239
+ canvasContext.rect(0, dirty.start, canvasInnerWidth, dirty.end - dirty.start);
1240
+ canvasContext.clip();
1241
+ canvasContext.clearRect(0, dirty.start, canvasInnerWidth, dirty.end - dirty.start);
1242
+ frame.replay(canvasContext, dirty);
1243
+ canvasContext.restore();
1244
+ }
1245
+ }
1246
+ }
1247
+ _renderSelectionLineHighlights(frame, selections, highlightedLines, layout, minimapLineHeight, canvasInnerWidth) {
1214
1248
  if (!this._selectionColor || this._selectionColor.isTransparent()) {
1215
1249
  return;
1216
1250
  }
1217
- canvasContext.fillStyle = this._selectionColor.transparent(0.5).toString();
1251
+ const fillStyle = this._selectionColor.transparent(0.5).toString();
1218
1252
  let y1 = 0;
1219
1253
  let y2 = 0;
1220
1254
  for (const selection of selections) {
@@ -1236,7 +1270,7 @@ class InnerMinimap extends Disposable {
1236
1270
  else {
1237
1271
  if (y2 > y1) {
1238
1272
  // flush
1239
- canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y1, canvasContext.canvas.width, y2 - y1);
1273
+ frame.fillRect(fillStyle, MINIMAP_GUTTER_WIDTH, y1, canvasInnerWidth, y2 - y1);
1240
1274
  }
1241
1275
  y1 = yy1;
1242
1276
  y2 = yy2;
@@ -1244,10 +1278,10 @@ class InnerMinimap extends Disposable {
1244
1278
  }
1245
1279
  if (y2 > y1) {
1246
1280
  // flush
1247
- canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y1, canvasContext.canvas.width, y2 - y1);
1281
+ frame.fillRect(fillStyle, MINIMAP_GUTTER_WIDTH, y1, canvasInnerWidth, y2 - y1);
1248
1282
  }
1249
1283
  }
1250
- _renderDecorationsLineHighlights(canvasContext, decorations, highlightedLines, layout, minimapLineHeight) {
1284
+ _renderDecorationsLineHighlights(frame, decorations, highlightedLines, layout, minimapLineHeight, canvasInnerWidth) {
1251
1285
  const highlightColors = new Map();
1252
1286
  // Loop backwards to hit first decorations with higher `zIndex`
1253
1287
  for (let i = decorations.length - 1; i >= 0; i--) {
@@ -1271,18 +1305,17 @@ class InnerMinimap extends Disposable {
1271
1305
  highlightColor = decorationColor.transparent(0.5).toString();
1272
1306
  highlightColors.set(decorationColor.toString(), highlightColor);
1273
1307
  }
1274
- canvasContext.fillStyle = highlightColor;
1275
1308
  for (let line = startLineNumber; line <= endLineNumber; line++) {
1276
1309
  if (highlightedLines.has(line)) {
1277
1310
  continue;
1278
1311
  }
1279
1312
  highlightedLines.set(line, true);
1280
1313
  const y = layout.getYForLineNumber(line, minimapLineHeight);
1281
- canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y, canvasContext.canvas.width, minimapLineHeight);
1314
+ frame.fillRect(highlightColor, MINIMAP_GUTTER_WIDTH, y, canvasInnerWidth, minimapLineHeight);
1282
1315
  }
1283
1316
  }
1284
1317
  }
1285
- _renderSelectionsHighlights(canvasContext, selections, lineOffsetMap, layout, lineHeight, tabSize, characterWidth, canvasInnerWidth) {
1318
+ _renderSelectionsHighlights(frame, selections, lineOffsetMap, layout, lineHeight, tabSize, characterWidth, canvasInnerWidth) {
1286
1319
  if (!this._selectionColor || this._selectionColor.isTransparent()) {
1287
1320
  return;
1288
1321
  }
@@ -1294,11 +1327,11 @@ class InnerMinimap extends Disposable {
1294
1327
  }
1295
1328
  const [startLineNumber, endLineNumber] = intersection;
1296
1329
  for (let line = startLineNumber; line <= endLineNumber; line++) {
1297
- this.renderDecorationOnLine(canvasContext, lineOffsetMap, selection, this._selectionColor, layout, line, lineHeight, lineHeight, tabSize, characterWidth, canvasInnerWidth);
1330
+ this.renderDecorationOnLine(frame, lineOffsetMap, selection, this._selectionColor, layout, line, lineHeight, lineHeight, tabSize, characterWidth, canvasInnerWidth);
1298
1331
  }
1299
1332
  }
1300
1333
  }
1301
- _renderDecorationsHighlights(canvasContext, decorations, lineOffsetMap, layout, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth) {
1334
+ _renderDecorationsHighlights(frame, decorations, lineOffsetMap, layout, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth) {
1302
1335
  // Loop forwards to hit first decorations with lower `zIndex`
1303
1336
  for (const decoration of decorations) {
1304
1337
  const minimapOptions = decoration.options.minimap;
@@ -1318,19 +1351,19 @@ class InnerMinimap extends Disposable {
1318
1351
  for (let line = startLineNumber; line <= endLineNumber; line++) {
1319
1352
  switch (minimapOptions.position) {
1320
1353
  case 1 /* MinimapPosition.Inline */:
1321
- this.renderDecorationOnLine(canvasContext, lineOffsetMap, decoration.range, decorationColor, layout, line, minimapLineHeight, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth);
1354
+ this.renderDecorationOnLine(frame, lineOffsetMap, decoration.range, decorationColor, layout, line, minimapLineHeight, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth);
1322
1355
  continue;
1323
1356
  case 2 /* MinimapPosition.Gutter */: {
1324
1357
  const y = layout.getYForLineNumber(line, minimapLineHeight);
1325
1358
  const x = 2;
1326
- this.renderDecoration(canvasContext, decorationColor, x, y, GUTTER_DECORATION_WIDTH, minimapLineHeight);
1359
+ this.renderDecoration(frame, decorationColor, x, y, GUTTER_DECORATION_WIDTH, minimapLineHeight);
1327
1360
  continue;
1328
1361
  }
1329
1362
  }
1330
1363
  }
1331
1364
  }
1332
1365
  }
1333
- renderDecorationOnLine(canvasContext, lineOffsetMap, decorationRange, decorationColor, layout, lineNumber, height, minimapLineHeight, tabSize, charWidth, canvasInnerWidth) {
1366
+ renderDecorationOnLine(frame, lineOffsetMap, decorationRange, decorationColor, layout, lineNumber, height, minimapLineHeight, tabSize, charWidth, canvasInnerWidth) {
1334
1367
  const y = layout.getYForLineNumber(lineNumber, minimapLineHeight);
1335
1368
  // Skip rendering the line if it's vertically outside our viewport
1336
1369
  if (y + height < 0 || y > this._model.options.canvasInnerHeight) {
@@ -1341,7 +1374,7 @@ class InnerMinimap extends Disposable {
1341
1374
  const endColumn = (endLineNumber === lineNumber ? decorationRange.endColumn : this._model.getLineMaxColumn(lineNumber));
1342
1375
  const x1 = this.getXOffsetForPosition(lineOffsetMap, lineNumber, startColumn, tabSize, charWidth, canvasInnerWidth);
1343
1376
  const x2 = this.getXOffsetForPosition(lineOffsetMap, lineNumber, endColumn, tabSize, charWidth, canvasInnerWidth);
1344
- this.renderDecoration(canvasContext, decorationColor, x1, y, x2 - x1, height);
1377
+ this.renderDecoration(frame, decorationColor, x1, y, x2 - x1, height);
1345
1378
  }
1346
1379
  getXOffsetForPosition(lineOffsetMap, lineNumber, column, tabSize, charWidth, canvasInnerWidth) {
1347
1380
  if (column === 1) {
@@ -1383,11 +1416,12 @@ class InnerMinimap extends Disposable {
1383
1416
  // goes over the canvas width
1384
1417
  return canvasInnerWidth;
1385
1418
  }
1386
- renderDecoration(canvasContext, decorationColor, x, y, width, height) {
1387
- canvasContext.fillStyle = decorationColor && decorationColor.toString() || '';
1388
- canvasContext.fillRect(x, y, width, height);
1419
+ renderDecoration(frame, decorationColor, x, y, width, height) {
1420
+ if (decorationColor) {
1421
+ frame.fillRect(decorationColor.toString(), x, y, width, height);
1422
+ }
1389
1423
  }
1390
- _renderSectionHeaders(layout) {
1424
+ _renderSectionHeaders(frame, canvasContext, layout) {
1391
1425
  const minimapLineHeight = this._model.options.minimapLineHeight;
1392
1426
  const sectionHeaderFontSize = this._model.options.sectionHeaderFontSize;
1393
1427
  const sectionHeaderLetterSpacing = this._model.options.sectionHeaderLetterSpacing;
@@ -1401,13 +1435,19 @@ class InnerMinimap extends Disposable {
1401
1435
  const foregroundColor = this._model.options.sectionHeaderFontColor;
1402
1436
  const foregroundFill = `rgb(${foregroundColor.r} ${foregroundColor.g} ${foregroundColor.b})`;
1403
1437
  const separatorStroke = foregroundFill;
1404
- const canvasContext = this._decorationsCanvas.domNode.getContext('2d');
1405
- canvasContext.letterSpacing = sectionHeaderLetterSpacing + 'px';
1406
- canvasContext.font = '500 ' + sectionHeaderFontSize + 'px ' + this._model.options.sectionHeaderFontFamily;
1407
- canvasContext.strokeStyle = separatorStroke;
1408
- canvasContext.lineWidth = 0.4;
1438
+ const letterSpacing = sectionHeaderLetterSpacing + 'px';
1439
+ const font = '500 ' + sectionHeaderFontSize + 'px ' + this._model.options.sectionHeaderFontFamily;
1440
+ const style = `${letterSpacing}:${font}:${backgroundFill}:${foregroundFill}:${horizontalScale}:${labelAreaWidth}`;
1441
+ const setStyle = (target) => {
1442
+ target.letterSpacing = letterSpacing;
1443
+ target.font = font;
1444
+ target.strokeStyle = separatorStroke;
1445
+ target.lineWidth = 0.4;
1446
+ target.scale(horizontalScale, 1);
1447
+ };
1448
+ // Measure the labels with the style they are drawn with
1409
1449
  canvasContext.save();
1410
- canvasContext.scale(horizontalScale, 1);
1450
+ setStyle(canvasContext);
1411
1451
  const decorations = this._model.getSectionHeaderDecorationsInViewport(layout.startLineNumber, layout.endLineNumber);
1412
1452
  decorations.sort((a, b) => a.range.startLineNumber - b.range.startLineNumber);
1413
1453
  const fitWidth = InnerMinimap._fitSectionHeader.bind(null, canvasContext, labelAreaWidth - MINIMAP_GUTTER_WIDTH);
@@ -1423,7 +1463,19 @@ class InnerMinimap extends Disposable {
1423
1463
  if (headerText) {
1424
1464
  nextLabelY = backgroundFillY + backgroundFillHeight;
1425
1465
  }
1426
- InnerMinimap._renderSectionLabel(canvasContext, headerText, decoration.options.minimap?.sectionHeaderStyle === 2 /* MinimapSectionHeaderStyle.Underlined */, backgroundFill, foregroundFill, labelAreaWidth, backgroundFillY, backgroundFillHeight, y, separatorY);
1466
+ const hasSeparatorLine = decoration.options.minimap?.sectionHeaderStyle === 2 /* MinimapSectionHeaderStyle.Underlined */;
1467
+ if (!headerText && !hasSeparatorLine) {
1468
+ continue;
1469
+ }
1470
+ // Glyphs can reach out of the label background, so give the label some room
1471
+ const top = backgroundFillY - sectionHeaderFontSize;
1472
+ const bottom = backgroundFillY + backgroundFillHeight + sectionHeaderFontSize;
1473
+ frame.add(top, bottom - top, `label:${style}:${hasSeparatorLine}:${headerText}`, false, target => {
1474
+ target.save();
1475
+ setStyle(target);
1476
+ InnerMinimap._renderSectionLabel(target, headerText, hasSeparatorLine, backgroundFill, foregroundFill, labelAreaWidth, backgroundFillY, backgroundFillHeight, y, separatorY);
1477
+ target.restore();
1478
+ });
1427
1479
  }
1428
1480
  canvasContext.restore();
1429
1481
  }