Don't do contrast adjustment for powerline characters

Richard Feldman created

Change summary

crates/terminal_view/src/terminal_element.rs | 70 +++++++++++++++++----
1 file changed, 57 insertions(+), 13 deletions(-)

Detailed changes

crates/terminal_view/src/terminal_element.rs 🔗

@@ -497,16 +497,44 @@ impl TerminalElement {
     /// Checks if a character is a decorative block/box-like character that should
     /// preserve its exact colors without contrast adjustment.
     ///
-    /// Fixes https://github.com/zed-industries/zed/issues/34234 - we can
-    /// expand this list if we run into more similar cases, but the goal
-    /// is to be conservative here.
+    /// This includes:
+    /// - Unicode box drawing, block elements, and geometric shapes
+    /// - Braille patterns and common symbols
+    /// - Powerline symbols and other terminal glyphs from Private Use Area
+    /// - Font icon sets commonly used in terminals (Nerd Fonts, etc.)
+    ///
+    /// These characters are typically used for visual borders, separators, and
+    /// icons where exact color matching is important for the visual design.
+    ///
+    /// Fixes https://github.com/zed-industries/zed/issues/34234
     fn is_decorative_character(ch: char) -> bool {
         matches!(
             ch as u32,
-            // 0x2500..=0x257F Box Drawing
-            // 0x2580..=0x259F Block Elements
-            // 0x25A0..=0x25D7 Geometric Shapes (block/box-like subset)
-            0x2500..=0x25D7
+            // Unicode Box Drawing and Block Elements
+            0x2500..=0x257F // Box Drawing
+            | 0x2580..=0x259F // Block Elements
+            | 0x25A0..=0x25FF // Geometric Shapes (includes triangles, circles, etc.)
+            | 0x2600..=0x26FF // Miscellaneous Symbols (includes stars, weather, etc.)
+            | 0x2700..=0x27BF // Dingbats
+            | 0x2800..=0x28FF // Braille Patterns
+
+            // Private Use Area - Common terminal/font icon ranges
+            | 0xE000..=0xE00F // Pomicons
+            | 0xE0A0..=0xE0A3 // Powerline Extra Symbols
+            | 0xE0B0..=0xE0C8 // Powerline Symbols
+            | 0xE0CA..=0xE0FF // Powerline Extra Symbols continued
+            | 0xE200..=0xE2A9 // Font Awesome Extension
+            | 0xE300..=0xE3E3 // Weather Icons
+            | 0xE5FA..=0xE6B5 // Seti-UI + Custom
+            | 0xE700..=0xE7C5 // Devicons
+            | 0xE800..=0xEA88 // Font Awesome
+            | 0xEA60..=0xEBEB // Codicons
+            | 0xF000..=0xF2E0 // Font Awesome (main range)
+            | 0xF0001..=0xF1AF0 // Material Design Icons
+            | 0xF300..=0xF32F // Font Logos
+            | 0xF400..=0xF532 // Octicons
+            | 0xF500..=0xFD46 // Material Design Icons
+            | 0xFD50..=0xFDFF // IEC Power Symbols
         )
     }
 
@@ -1623,16 +1651,32 @@ mod tests {
 
         // The specific character from the issue
         assert!(TerminalElement::is_decorative_character('◗')); // U+25D7
+        assert!(TerminalElement::is_decorative_character('◘')); // U+25D8 (now included in Geometric Shapes)
+        assert!(TerminalElement::is_decorative_character('◙')); // U+25D9 (now included in Geometric Shapes)
+
+        // Powerline symbols (Private Use Area)
+        assert!(TerminalElement::is_decorative_character('\u{E0B0}')); // Powerline right triangle
+        assert!(TerminalElement::is_decorative_character('\u{E0B2}')); // Powerline left triangle
+        assert!(TerminalElement::is_decorative_character('\u{E0B4}')); // Powerline right half circle (the actual issue!)
+        assert!(TerminalElement::is_decorative_character('\u{E0B6}')); // Powerline left half circle
+
+        // Other common terminal glyphs
+        assert!(TerminalElement::is_decorative_character('\u{E0A0}')); // Version control branch
+        assert!(TerminalElement::is_decorative_character('\u{F00C}')); // Font Awesome check
+        assert!(TerminalElement::is_decorative_character('\u{F111}')); // Font Awesome circle
+        assert!(TerminalElement::is_decorative_character('\u{E711}')); // Devicons
+        assert!(TerminalElement::is_decorative_character('\u{EA71}')); // Codicons folder
+        assert!(TerminalElement::is_decorative_character('\u{F401}')); // Octicons
+        assert!(TerminalElement::is_decorative_character('\u{FD50}')); // IEC Power Symbol
 
         // Characters that should NOT be considered decorative
-        assert!(!TerminalElement::is_decorative_character('A'));
-        assert!(!TerminalElement::is_decorative_character('a'));
-        assert!(!TerminalElement::is_decorative_character('0'));
-        assert!(!TerminalElement::is_decorative_character(' '));
+        assert!(!TerminalElement::is_decorative_character('A')); // Regular letter
+        assert!(!TerminalElement::is_decorative_character('$')); // Symbol
+        assert!(!TerminalElement::is_decorative_character(' ')); // Space
         assert!(!TerminalElement::is_decorative_character('←')); // U+2190 (Arrow, not in our ranges)
         assert!(!TerminalElement::is_decorative_character('→')); // U+2192 (Arrow, not in our ranges)
-        assert!(!TerminalElement::is_decorative_character('◘')); // U+25D8 (Just outside our range)
-        assert!(!TerminalElement::is_decorative_character('◙')); // U+25D9 (Just outside our range)
+        assert!(!TerminalElement::is_decorative_character('\u{1F600}')); // Emoji (not in our ranges)
+        assert!(!TerminalElement::is_decorative_character('\u{FFFE}')); // Not in our ranges
     }
 
     #[test]