diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index e28b409a..e50fdd17 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -539,10 +539,12 @@ export class SearchAddon implements ITerminalAddon { } const findResultDecoration = terminal.registerDecoration({ marker }); findResultDecoration?.onRender((e) => { - e.style.backgroundColor = 'blue'; - e.style.opacity = '60%'; - e.style.left = `${result.col * e.clientWidth}px`; - e.style.width = `${e.clientWidth * result.term.length}px`; + if (!e.classList.contains('xterm-find-result-decoration')) { + e.classList.add('xterm-find-result-decoration'); + // decoration's clientWidth = actualCellWidth + e.style.left = `${e.clientWidth * result.col}px`; + e.style.width = `${e.clientWidth * result.term.length}px`; + } }); return findResultDecoration; } diff --git a/css/xterm.css b/css/xterm.css index ab3965b4..ded93074 100644 --- a/css/xterm.css +++ b/css/xterm.css @@ -178,3 +178,8 @@ z-index: 6; position: absolute; } + +.xterm-find-result-decoration { + background-color: blue; + opacity: 60%; +} \ No newline at end of file