Handle selections in the middle of ligatures too

This commit is contained in:
Daniel Imms
2025-01-06 11:03:10 -08:00
parent 5bfb130f03
commit c7a1e0aea3
2 changed files with 22 additions and 4 deletions
@@ -84,6 +84,7 @@ export class DomRendererRowFactory {
let charElement: HTMLSpanElement | undefined;
let cellAmount = 0;
let text = '';
let i = 0;
let oldBg = 0;
let oldFg = 0;
let oldExt = 0;
@@ -122,8 +123,11 @@ export class DomRendererRowFactory {
const range = joinedRanges.shift()!;
// If the ligature's selection state is not consistent, don't join it. This helps the
// selection render correctly regardless whether they should be joined.
if (this._isCellInSelection(range[0], row) !== this._isCellInSelection(range[1], row)) {
isValidJoinRange = false;
const firstSelectionState = this._isCellInSelection(range[0], row);
for (i = range[0] + 1; i < range[1]; i++) {
isValidJoinRange &&= (firstSelectionState === this._isCellInSelection(i, row));
}
if (!isValidJoinRange) {
skipJoinedCheckUntilX = range[1];
} else {
isJoined = true;