fix(span): dont render control characters (#1312)
This commit is contained in:
@@ -345,7 +345,7 @@ impl Buffer {
|
|||||||
let max_width = max_width.try_into().unwrap_or(u16::MAX);
|
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 mut remaining_width = self.area.right().saturating_sub(x).min(max_width);
|
||||||
let graphemes = UnicodeSegmentation::graphemes(string.as_ref(), true)
|
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))
|
.map(|symbol| (symbol, symbol.width() as u16))
|
||||||
.filter(|(_symbol, width)| *width > 0)
|
.filter(|(_symbol, width)| *width > 0)
|
||||||
.map_while(|(symbol, width)| {
|
.map_while(|(symbol, width)| {
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ impl<'a> Span<'a> {
|
|||||||
self.content
|
self.content
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.graphemes(true)
|
.graphemes(true)
|
||||||
.filter(|g| *g != "\n")
|
.filter(|g| !g.contains(char::is_control))
|
||||||
.map(move |g| StyledGrapheme { symbol: g, style })
|
.map(move |g| StyledGrapheme { symbol: g, style })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user