Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/browser/renderer/dom/DomRendererRowFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ export class DomRendererRowFactory {
cellAmount
&& (
(isInSelection && oldIsInSelection)
|| (!isInSelection && cell.bg === oldBg)
|| (!isInSelection && !oldIsInSelection && cell.bg === oldBg)
)
&& (
(isInSelection && oldIsInSelection && colors.selectionForeground)
|| (!(isInSelection && oldIsInSelection && colors.selectionForeground) && cell.fg === oldFg)
|| cell.fg === oldFg
)
Comment on lines 167 to 174
Copy link
Copy Markdown
Member

@jerch jerch Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion - for the sake of readability lets separate concerns here:

  // selection state must not change
  && isInSelection === oldIsInSelection
  // outside of selections BG must match
  && (!isInSelection && cell.bg === oldBg)
  // default FG must match
  // exception: in selections selectionForeground may override FG
  && (cell.fg === oldFg || (isInSelection && colors.selectionForeground))

To me thats much easier to grasp than deep nested conditions, hopefully I covered all cases 😸.

The FG rule is still nested, at least it pulls the more likely case to the left, which should result in faster processing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That re-write seems to work fine my testing. And I'm inclined to agree it is cleaner. I was aiming for a minimal fix, but I'm happy also doing minor logic simplification.

&& cell.extended.ext === oldExt
&& isLinkHover === oldLinkHover
Expand Down