hack around DOM renderer issue, fix api tests

This commit is contained in:
Jörg Breitbart
2022-12-04 22:26:29 +01:00
parent d19361ac85
commit 39c2e57ad3
5 changed files with 21 additions and 16 deletions
+2
View File
@@ -376,6 +376,8 @@ export class DomRenderer extends Disposable implements IRenderer {
}
private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {
// FIXME: offset calculation is wrong (temp. fixed by adding empty spans for wide chars
// to fullfill column to element index identity assumption)
while (x !== x2 || y !== y2) {
const row = this._rowElements[y];
if (!row) {
@@ -32,6 +32,7 @@ export class DomRendererRowFactory {
private _selectionStart: [number, number] | undefined;
private _selectionEnd: [number, number] | undefined;
private _columnSelectMode: boolean = false;
private _nullSpan: HTMLSpanElement;
constructor(
private readonly _document: Document,
@@ -42,6 +43,8 @@ export class DomRendererRowFactory {
@IDecorationService private readonly _decorationService: IDecorationService,
@IThemeService private readonly _themeService: IThemeService
) {
this._nullSpan = this._document.createElement('span');
this._nullSpan.style.width = `0`;
}
public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {
@@ -75,6 +78,8 @@ export class DomRendererRowFactory {
// The character to the left is a wide character, drawing is owned by the char at x-1
if (width === 0) {
// hack: fix underline bug for wide chars by appending an empty span
fragment.appendChild(this._nullSpan.cloneNode());
continue;
}