[PR #15701] Reimplement TextBuffer::Reflow #30706

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

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

State: closed
Merged: Yes


Subjectively speaking, this commit makes 3 improvements:

  • Most importantly, it now would work with arbitrary Unicode text.
    (No more IsGlyphFullWidth or DBCS handling during reflow.)
  • Due to the simpler implementation it hopefully makes review of
    future changes and maintenance simpler. (~3x less LOC.)
  • It improves perf. by 1-2 orders of magnitude.
    (At 120x9001 with a full buffer I get 60ms -> 2ms.)

Unfortunately, I'm not confident that the new code replicates the old
code exactly, because I failed to understand it. During development
I simply tried to match its behavior with what I think reflow should do.

Closes #797
Closes #3088
Closes #4968
Closes #6546
Closes #6901
Closes #15964
Closes MSFT:19446208

Related to #5800 and #8000

Validation Steps Performed

  • Unit tests
  • Feature tests
  • Reflow with a scrollback
  • Reflowing the cursor cell causes a forced line-wrap
    (Even at the end of the buffer. )
  • color 8f and reflowing retains the background color
  • Enter alt buffer, Resize window, Exit alt buffer
**Original Pull Request:** https://github.com/microsoft/terminal/pull/15701 **State:** closed **Merged:** Yes --- Subjectively speaking, this commit makes 3 improvements: * Most importantly, it now would work with arbitrary Unicode text. (No more `IsGlyphFullWidth` or DBCS handling during reflow.) * Due to the simpler implementation it hopefully makes review of future changes and maintenance simpler. (~3x less LOC.) * It improves perf. by 1-2 orders of magnitude. (At 120x9001 with a full buffer I get 60ms -> 2ms.) Unfortunately, I'm not confident that the new code replicates the old code exactly, because I failed to understand it. During development I simply tried to match its behavior with what I think reflow should do. Closes #797 Closes #3088 Closes #4968 Closes #6546 Closes #6901 Closes #15964 Closes MSFT:19446208 Related to #5800 and #8000 ## Validation Steps Performed * Unit tests ✅ * Feature tests ✅ * Reflow with a scrollback ✅ * Reflowing the cursor cell causes a forced line-wrap ✅ (Even at the end of the buffer. ✅) * `color 8f` and reflowing retains the background color ✅ * Enter alt buffer, Resize window, Exit alt buffer ✅
claunia added the pull-request label 2026-01-31 09:42:28 +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#30706