[PR #6224] WIP: Draw backgrounds separately from foregrounds #26607

Open
opened 2026-01-31 09:17:06 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6224

State: closed
Merged: No


This implements #6193. It's a WIP.

Summary of the Pull Request


Alright, I've got this down to a single function that takes each dirty region and produces...

  • A list of damaged backgrounds to repaint
  • A list of colored cluster lists to repaint

I don't like the number of vectors here, but... we're saving money by invalidating narrowly whenever possible.

Dirty Region [1..n]
- Origin (SCREEN CHAR COORDS)
- At line wrap point
- Region intersected right half of DBCS char (left trim)
- Background Run [1..n]
  - Attribute
  - Rect Covered (SCREEN CHAR COORDS)
- Colored Foreground Run [1..n]
  - Attribute
  - Columns
  - Cluster [1..n]

Right now, because of some minor issues (#2661), backgrounds are attributes and actual final colors. It's not pleasant!

To fix:

  • reverse is occasionally (!) broken
  • render engines need flags to say "plz no background splitting" (vt engine needs to update drawing brushes per text run, foreground and background)
  • need to re-enable space optimization (if the cell is non-printing (and has no underline, etc.), no point in forwarding it to the cluster renderer!)

References

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

**Original Pull Request:** https://github.com/microsoft/terminal/pull/6224 **State:** closed **Merged:** No --- This implements #6193. It's a WIP. ## Summary of the Pull Request --- Alright, I've got this down to a single function that takes each dirty region and produces... * A list of damaged backgrounds to repaint * A list of colored cluster lists to repaint I don't like the number of vectors here, but... we're saving money by invalidating narrowly whenever possible. ``` Dirty Region [1..n] - Origin (SCREEN CHAR COORDS) - At line wrap point - Region intersected right half of DBCS char (left trim) - Background Run [1..n] - Attribute - Rect Covered (SCREEN CHAR COORDS) - Colored Foreground Run [1..n] - Attribute - Columns - Cluster [1..n] ``` Right now, because of some minor issues (#2661), backgrounds are attributes _and_ actual final colors. It's not pleasant! To fix: * [ ] reverse is occasionally (!) broken * [x] render engines need flags to say "plz no background splitting" (vt engine needs to update drawing brushes per text run, foreground _and_ background) * [ ] need to re-enable space optimization (if the cell is non-printing (and has no underline, etc.), no point in forwarding it to the cluster renderer!) --- <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #xxx * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
claunia added the pull-request label 2026-01-31 09:17:06 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26607