Skip to content

Commit 2f2154c

Browse files
authored
Merge pull request #4762 from tisilent/Fix-Domrenderer-Invisible
Add handling of invisible
2 parents cc83b9a + 056206d commit 2f2154c

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/browser/renderer/dom/DomRendererRowFactory.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ export class DomRendererRowFactory {
180180
&& !isDecorated
181181
) {
182182
// no span alterations, thus only account chars skipping all code below
183-
text += chars;
183+
if (cell.isInvisible()) {
184+
text += WHITESPACE_CELL_CHAR;
185+
} else {
186+
text += chars;
187+
}
184188
cellAmount++;
185189
continue;
186190
} else {

test/playwright/SharedRendererTests.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
1919
ctx.value.page.evaluate(`
2020
window.term.options.minimumContrastRatio = 1;
2121
window.term.options.allowTransparency = false;
22+
window.term.options.theme = undefined;
2223
`);
2324
// Clear the cached screenshot before each test
2425
frameDetails = undefined;
@@ -144,7 +145,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
144145
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 8, 1), [22, 23, 24, 255]);
145146
});
146147

147-
test('foreground 0-15 inivisible', async () => {
148+
test('foreground 0-15 invisible', async () => {
148149
const theme: ITheme = {
149150
black: '#010203',
150151
red: '#040506',
@@ -167,7 +168,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
167168
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 8, 1), [0, 0, 0, 255]);
168169
});
169170

170-
test('background 0-15 inivisible', async () => {
171+
test('background 0-15 invisible', async () => {
171172
const theme: ITheme = {
172173
black: '#010203',
173174
red: '#040506',
@@ -1070,6 +1071,19 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
10701071
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [0, 0, 255, 255]); // inverse background of ' ' should be decoration bg override
10711072
});
10721073
});
1074+
1075+
test.describe('regression tests', () => {
1076+
test('#4758: multiple invisible text characters without SGR change should not be rendered', async () => {
1077+
// Regression test: #4758 when multiple invisible characters are used
1078+
await ctx.value.proxy.writeln(`■\x1b[8m■■`);
1079+
// Full refresh as the before result is the same as after
1080+
await ctx.value.proxy.refresh(0, await ctx.value.proxy.rows - 1);
1081+
// Control to ensure rendering has occurred
1082+
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 255, 255, 255]);
1083+
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [0, 0, 0, 255]);
1084+
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 3, 1), [0, 0, 0, 255]);
1085+
});
1086+
});
10731087
}
10741088

10751089
/**

0 commit comments

Comments
 (0)