From ad08a2e15b59619ffa24e0efbc60f739f025a181 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:15:16 -0800 Subject: [PATCH] Render selection under ligatures for webgl Part of #5231 --- addons/addon-webgl/src/WebglRenderer.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/addon-webgl/src/WebglRenderer.ts b/addons/addon-webgl/src/WebglRenderer.ts index 6c270d12..d96f0817 100644 --- a/addons/addon-webgl/src/WebglRenderer.ts +++ b/addons/addon-webgl/src/WebglRenderer.ts @@ -507,8 +507,15 @@ export class WebglRenderer extends Disposable implements IRenderer { j = ((y * terminal.cols) + x) * RENDER_MODEL_INDICIES_PER_CELL; this._glyphRenderer.value!.updateCell(x, y, NULL_CELL_CODE, 0, 0, 0, NULL_CELL_CHAR, 0, 0); this._model.cells[j] = NULL_CELL_CODE; - // Don't re-resolve the cell color since multi-colored ligature backgrounds are not - // supported + // HACK: Generally we don't support multi-colored ligature backgrounds, however it's + // important here that we re-resolve the cell color since selections are regular + // background colors. + // + // This can result in bad aliasing since currently ligature glyphs drawn using a single + // texture. This is most noticable when the background colors across the ligature differ + // drastically. This could be improved in the future by sourcing from different glyphs + // for each cell when the foreground or background differ. + this._cellColorResolver.resolve(cell, x, row, this.dimensions.device.cell.width); this._model.cells[j + RENDER_MODEL_BG_OFFSET] = this._cellColorResolver.result.bg; this._model.cells[j + RENDER_MODEL_FG_OFFSET] = this._cellColorResolver.result.fg; this._model.cells[j + RENDER_MODEL_EXT_OFFSET] = this._cellColorResolver.result.ext;