Repository navigation
text: Support inline code style overrides - #3663
Merged
huacnlee merged 3 commits intoOct 24, 2026
Merged
Conversation
Expose one StyleRefinement override for inline code typography and box presentation, preserving the existing HighlightStyle APIs. Keep same-size code and prose separate, and share insets across shaping, wrapping, painting, and table measurement. Covers the font-size use case from longbridge#3639. AI-assisted implementation, regression tests, and bilingual documentation.
huacnlee
approved these changes
Oct 24, 2026
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.
Description
HighlightStylecannot express inline code font size, borders, radius, or padding. Add oneinline_code_style(StyleRefinement)override for typography and box presentation, covering both font-size customization and outlined code spans. Supersedes #3639.Unspecified properties inherit the resolved theme or explicit style. User overrides apply after surface-color adaptation, including on inverted surfaces. Existing
inline_code(HighlightStyle)andwith_inline_code(HighlightStyle)calls remain supported, and the public ComponentTextViewStylefields are unchanged. Defaults retain the existing appearance: a 0.875 font-size ratio and no border.Shaping, wrapping, painting, and table column measurement share font-size and inset resolution. Code and prose stay separate when their font sizes match, preventing code backgrounds and padding from extending into adjacent prose. Backgrounds and borders fade with streamed text.
English and Chinese documentation describe the supported properties. Line height remains paragraph-owned; margin, positioning, flex, explicit box dimensions, overflow, and interaction properties are not applied to inline code.
Example
Public API
gpui-base
TextViewStyle::with_inline_code_style(self, style: StyleRefinement) -> Self— Set explicit inline code typography and box refinements.TextViewStyle::inline_code_style(&self) -> &StyleRefinement— Read the explicit refinement.TextView::inline_code_style(self, style: StyleRefinement) -> Self— Refine inline code over the resolved style.gpui-component
text::TextView::inline_code_style(self, style: StyleRefinement) -> Self— Apply the same override through the Component facade.Breaking Changes
None for existing consumers. Existing HighlightStyle APIs, imports, defaults, and public Component style fields remain compatible.
Validation
cargo test -p gpui-base -p gpui-component --features gpui-component/test-support --lib text:: --locked— 391 Base and 69 Component tests passed.cargo clippy -p gpui-base -p gpui-component --features gpui-component/test-support --all-targets --locked -- --deny warnings— passed.cargo fmt --all --check,git diff --check, and whole-repositorytypos1.40.0 — passed.atual, resolving the unrelated CI false positive.Validation uses headless native text/layout tests. Windows/Linux rendering and performance were not checked locally. Implementation, tests, and documentation were written with AI assistance.