fix(span): dont render control characters (#1312)

This commit is contained in:
EdJoPaTo
2024-12-08 11:10:58 +01:00
committed by GitHub
parent 452366aa9e
commit f57b696fdc
2 changed files with 2 additions and 2 deletions

View File

@@ -345,7 +345,7 @@ impl Buffer {
let max_width = max_width.try_into().unwrap_or(u16::MAX);
let mut remaining_width = self.area.right().saturating_sub(x).min(max_width);
let graphemes = UnicodeSegmentation::graphemes(string.as_ref(), true)
.filter(|symbol| !symbol.contains(|char: char| char.is_control()))
.filter(|symbol| !symbol.contains(char::is_control))
.map(|symbol| (symbol, symbol.width() as u16))
.filter(|(_symbol, width)| *width > 0)
.map_while(|(symbol, width)| {

View File

@@ -322,7 +322,7 @@ impl<'a> Span<'a> {
self.content
.as_ref()
.graphemes(true)
.filter(|g| *g != "\n")
.filter(|g| !g.contains(char::is_control))
.map(move |g| StyledGrapheme { symbol: g, style })
}