feat: support 'px' format in lineHeight option#5730
Open
evandroreichert wants to merge 1 commit intoxtermjs:masterfrom
Open
feat: support 'px' format in lineHeight option#5730evandroreichert wants to merge 1 commit intoxtermjs:masterfrom
evandroreichert wants to merge 1 commit intoxtermjs:masterfrom
Conversation
Allow lineHeight to accept a string with 'px' suffix (e.g. '23px') in addition to the existing numeric multiplier. This enables setting an absolute pixel line height, which is useful when precise control over row spacing is needed regardless of font size. - Update type definitions to accept `number | string` - Add validation for px string format in OptionsService - Handle px values in DomRenderer and WebglRenderer dimension calculations - Update WebGL char atlas config type Fixes xtermjs#2612
b5b8d10 to
e4159ac
Compare
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.
Summary
Closes #2612
Allow
lineHeightto accept a string with a'px'suffix (e.g.'23px') in addition to the existing numeric multiplier, enabling precise pixel-level control over row spacing.Changes
xterm.d.ts,Services.ts):lineHeightnow acceptsnumber | stringOptionsService.ts): String values must end with'px'and parse to a number >= 1Math.max(Math.floor(parseFloat(lineHeight) * dpr), charHeight)instead of the multiplier-based calculationTypes.ts): UpdatedICharAtlasConfig.lineHeightto matchBackwards compatibility
Fully backwards compatible — existing numeric
lineHeightvalues behave identically. The new string format is opt-in.Example usage