Skip to content

Commit 9931bab

Browse files
committed
Improve rendering for minimap blocks
1 parent 9fde1ae commit 9931bab

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/vs/editor/browser/viewParts/minimap/minimap.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,7 @@ class InnerMinimap extends Disposable {
16661666
const content = lineData.content;
16671667
const tokens = lineData.tokens;
16681668
const maxDx = target.width - charWidth;
1669+
const force1pxHeight = (minimapLineHeight === 1);
16691670

16701671
let dx = MINIMAP_GUTTER_WIDTH;
16711672
let charIndex = 0;
@@ -1697,9 +1698,9 @@ class InnerMinimap extends Disposable {
16971698

16981699
for (let i = 0; i < count; i++) {
16991700
if (renderMinimap === RenderMinimap.Blocks) {
1700-
minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, backgroundColor, useLighterFont);
1701+
minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, backgroundColor, useLighterFont, force1pxHeight);
17011702
} else { // RenderMinimap.Text
1702-
minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, backgroundColor, fontScale, useLighterFont, minimapLineHeight === 1);
1703+
minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, backgroundColor, fontScale, useLighterFont, force1pxHeight);
17031704
}
17041705

17051706
dx += charWidth;

src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ export class MinimapCharRenderer {
8282
dy: number,
8383
color: RGBA8,
8484
backgroundColor: RGBA8,
85-
useLighterFont: boolean
85+
useLighterFont: boolean,
86+
force1pxHeight: boolean
8687
): void {
8788
const charWidth = Constants.BASE_CHAR_WIDTH * this.scale;
8889
const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale;
89-
if (dx + charWidth > target.width || dy + charHeight > target.height) {
90+
const renderHeight = (force1pxHeight ? 1 : charHeight);
91+
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
9092
console.warn('bad render request outside image data');
9193
return;
9294
}
@@ -110,7 +112,7 @@ export class MinimapCharRenderer {
110112
const dest = target.data;
111113

112114
let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT;
113-
for (let y = 0; y < charHeight; y++) {
115+
for (let y = 0; y < renderHeight; y++) {
114116
let column = row;
115117
for (let x = 0; x < charWidth; x++) {
116118
dest[column++] = colorR;

0 commit comments

Comments
 (0)