-
-
Notifications
You must be signed in to change notification settings - Fork 363
Description
Bug Description
Emojis with Unicode variation selectors (like πΌοΈ and π₯οΈ) cause the entire theme.yml file to be silently ignored due to deserialization failure.
Reproduction Steps
- Create
~/.config/eza/theme.ymlwith:
filenames:
data: {icon: {glyph: πΎ}} # Works - single codepoint
Pictures: {icon: {glyph: πΌοΈ}} # Fails - has variation selector
Desktop: {icon: {glyph: π₯οΈ}} # Fails - has variation selector- Run
eza -l --icons
Expected Behavior
All custom icons should display, including emojis with variation selectors.
Actual Behavior
- The
dataicon (πΎ) displays correctly - Theme parsing fails silently when it encounters πΌοΈ or π₯οΈ
- All subsequent icons in theme.yml are ignored
- User receives no error message
Root Cause
The glyph field in IconStyle and IconStyleOverride structs is defined as Option<char>:
src/theme/ui_styles.rs:18
pub struct IconStyle {
pub glyph: Option<char>, // β Can only hold single Unicode scalar
pub style: Option<Style>,
}src/options/config.rs:210
pub struct IconStyleOverride {
pub glyph: Option<char>, // β Same issue
pub style: Option<StyleOverride>,
}Rust's char type represents a single Unicode scalar value. However, many emojis consist of multiple codepoints:
| Emoji | Description | Codepoints | Status |
|---|---|---|---|
| πΌοΈ | Picture frame | U+1F5BC + U+FE0F | β Fails |
| π₯οΈ | Desktop computer | U+1F5A5 + U+FE0F | β Fails |
| π¨βπ» | Man technologist | U+1F468 + U+200D + U+1F4BB | β Fails |
| πΊπΈ | US flag | U+1F1FA + U+1F1F8 | β Fails |
| πΎ | Floppy disk | U+1F4BE | β Works |
The second codepoint (U+FE0F) is a variation selector - an invisible modifier that tells the system to render the character as a colorful emoji.
Silent Failure
src/options/config.rs:617-621
pub fn to_theme(&self) -> Option<UiStyles> {
let ui_styles_override: Option<UiStylesOverride> = {
let file = std::fs::File::open(&self.location).ok()?;
serde_norway::from_reader(&file).ok() // β .ok() swallows errors!
};
FromOverride::from(ui_styles_override, Some(UiStyles::default()))
}The .ok() converts deserialization errors into None, causing the entire theme.yml to be ignored with no warning.
Affected Emojis
This affects:
- β Emojis with variation selectors (U+FE0F): πΌοΈ π₯οΈ βοΈ βοΈ
- β ZWJ (Zero Width Joiner) sequences: π¨βπ» π©βπ¨ π¨βπ©βπ§βπ¦
- β Flag emojis (regional indicators): πΊπΈ π¬π§ π―π΅
- β Skin tone modifiers: ππ» ππΏ
- β Any other multi-codepoint emoji
Environment
- eza version: v0.23.4
- OS: Linux (affects all platforms)
- Shell: Any
- Terminal: Any
Proposed Solution
- Change
glyphfield fromOption<char>toOption<String>to support grapheme clusters - Add proper error handling to report deserialization failures instead of silently ignoring them
This would enable full emoji support while maintaining backward compatibility with existing single-character icons.