fix(theme): support multi-codepoint emojis in theme.yml glyph field #1655
+183
β21
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
Fixes #1654 - Adds support for multi-codepoint emojis in
theme.ymlglyph fields.Problem
Emojis with Unicode variation selectors (πΌοΈ, π₯οΈ) and other multi-codepoint sequences caused the entire
theme.ymlfile to be silently ignored. Theglyphfield was typed asOption<char>, which can only hold single Unicode scalar values.Solution
Changed the
glyphfield fromOption<char>toOption<String>to support:Also improved error handling to report theme parsing failures instead of silently failing.
Changes
Type Changes
src/theme/ui_styles.rs: ChangedIconStyle::glyphfromOption<char>toOption<String>src/options/config.rs: ChangedIconStyleOverride::glyphfromOption<char>toOption<String>Copytrait from structs containingStringfields (IconStyle,FileNameStyle,IconStyleOverride,FileNameStyleOverride)Function Updates
src/output/icons.rs: Changedicon_for_file()return type fromchartoStringsrc/output/file_name.rs: Updated icon usage to work withStringtypesrc/theme/mod.rs: Changed from dereferencing to cloning for non-Copy typesError Handling
src/options/config.rs: Replaced silent.ok()with explicit error messages when theme parsing failsTesting
Added 7 comprehensive unit tests covering:
Test Results:
cargo fmtβBackward Compatibility
Fully backward compatible - existing single-character icons continue to work without changes.
Example Usage
Checklist
cargo test)cargo clippy)cargo fmt)