Repository navigation
[FEATURE REQUEST] Shape terminal text per foreground color section - #37
Merged
Raiden-MeixElysia merged 3 commits intoOct 28, 2026
Merged
Raiden-MeixElysia merged 3 commits into
Raiden-MeixElysia merged 3 commits into
Conversation
Shape foreground sections independently to preserve color-boundary ligature breaks without CoreText's expensive multi-color line path. Clip section ink at device-aligned boundaries and retain same-color ligatures. Validation: fmt, clippy -D warnings, release build, visual checks and 273 library tests passed. Three existing shell tests require unavailable fish/pwsh and were excluded. Window-content sampling under cmatrix remains about 57.7 Hz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
What and why
The terminal now shapes each row in sections of one foreground color instead of in one
shape_linecall that holds all of the row's color runs. On macOS, CoreText takes an expensive path for a line with many differently colored runs, and gpui keeps the run colors in its shape cache key, so a busy screen kept shaping the same text again. Undercmatrix -u 0the Mac went from ~27 Hz to ~57.7 Hz.color_atlookup is gone.!=,->or==in one color still form, since they shape in one call, and a color change still breaks them.src/term/paint.rsintosrc/term/paint/glyphs.rs, andpaint.rs's tests intosrc/term/paint/tests.rs, so every file stays under 500 lines.How it was tested
scripts/check.shon the branch merged withmain: fmt, clippy-D warningsand the house rules pass, and 295 tests pass. The four tests that need fish or pwsh were not run, since the Mac lacks both:fish_loads_its_script_and_restores_its_data_dirs,under_wsl_each_shell_reports_its_folder_as_windows_names_it,powershell_reports_its_folder_byte_for_byte_and_keeps_the_status,only_an_interactive_shell_leading_its_group_draws_its_prompt.New unit tests in
src/term/paint/glyphs/tests.rs:By hand: ligatures and color boundaries on macOS, Windows 11 and NixOS; CJK, powerline and Nerd Font icons on macOS.
Frame rate under
cmatrix -u 0, on two machines: a Mac, and one PC that runs both Windows 11 and NixOS. Each overlay counts frames its own way, so compare within a row:mainChecklist
[FEATURE REQUEST],[BUG REPORT]or[Other]