This commit is contained in:
Jörg Breitbart
2023-07-22 22:50:05 +02:00
parent 089dc282c3
commit aa6e8d91c2
2 changed files with 3 additions and 11 deletions
+1 -1
View File
@@ -37,6 +37,7 @@ export class DomRenderer extends Disposable implements IRenderer {
private _rowContainer: HTMLElement; private _rowContainer: HTMLElement;
private _rowElements: HTMLElement[] = []; private _rowElements: HTMLElement[] = [];
private _selectionContainer: HTMLElement; private _selectionContainer: HTMLElement;
private _linkState = new Uint8Array(3);
public dimensions: IRenderDimensions; public dimensions: IRenderDimensions;
@@ -412,7 +413,6 @@ export class DomRenderer extends Disposable implements IRenderer {
return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`; return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;
} }
private _linkState = new Uint8Array(3);
private _handleLinkHover(e: ILinkifierEvent): void { private _handleLinkHover(e: ILinkifierEvent): void {
this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true); this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);
} }
@@ -61,10 +61,6 @@ export class DomRendererRowFactory {
metrics: Uint8Array, metrics: Uint8Array,
linkState: Uint8Array linkState: Uint8Array
): DocumentFragment { ): DocumentFragment {
// NOTE: `cellMap` maps cell positions to a span element index in a row.
// All positions should be updated, even skipped ones after wide chars or left overs at the end,
// otherwise the mouse hover logic might mark the wrong elements as underlined.
const fragment = this._document.createDocumentFragment(); const fragment = this._document.createDocumentFragment();
const joinedRanges = this._characterJoinerService.getJoinedCharacters(row); const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);
@@ -130,9 +126,6 @@ export class DomRendererRowFactory {
width = cell.getWidth(); width = cell.getWidth();
} }
const isInSelection = this._isCellInSelection(x, row); const isInSelection = this._isCellInSelection(x, row);
const isCursorCell = isCursorRow && x === cursorX; const isCursorCell = isCursorRow && x === cursorX;
const cc = cell.getCode(); const cc = cell.getCode();
@@ -149,6 +142,7 @@ export class DomRendererRowFactory {
* - fg/bg/ul did not change * - fg/bg/ul did not change
* - char not part of a selection * - char not part of a selection
* - char is not cursor * - char is not cursor
* - underline from hover state did not change
*/ */
if ( if (
cellAmount && width === 1 && !isCombined cellAmount && width === 1 && !isCombined
@@ -184,9 +178,6 @@ export class DomRendererRowFactory {
oldExt = cell.extended.ext; oldExt = cell.extended.ext;
oldLinkHover = isLinkHover; oldLinkHover = isLinkHover;
if (width > 1) { if (width > 1) {
charElement.style.width = `${cellWidth * width}px`; charElement.style.width = `${cellWidth * width}px`;
} }
@@ -271,6 +262,7 @@ export class DomRendererRowFactory {
charElement.classList.add(STRIKETHROUGH_CLASS); charElement.classList.add(STRIKETHROUGH_CLASS);
} }
// apply link hover underline late, effectively overrides any previous text-decoration settings
if (isLinkHover) { if (isLinkHover) {
charElement.style.textDecoration = 'underline'; charElement.style.textDecoration = 'underline';
} }