fix(unicode): add support for more unicode characters

This commit is contained in:
Alex Pasmantier 2025-04-18 12:18:52 +02:00
parent 315a9f71fa
commit 86d62df8a6

View File

@ -195,6 +195,9 @@ const ALL_NF_RANGES: [&std::ops::RangeInclusive<char>; 10] = [
&NF_RANGE_POWERLINE_2,
];
const VARIOUS_UNIT_WIDTH_SYMBOLS_RANGE: std::ops::RangeInclusive<char> =
'\u{2000}'..='\u{25FF}';
pub struct ReplaceNonPrintableConfig {
pub replace_tab: bool,
pub tab_width: usize,
@ -330,6 +333,10 @@ pub fn replace_non_printable(
c if ALL_NF_RANGES.iter().any(|r| r.contains(&c)) => {
output.push(c);
}
// Other unit width symbols
c if VARIOUS_UNIT_WIDTH_SYMBOLS_RANGE.contains(&c) => {
output.push(c);
}
// Unicode characters above 0x0700 seem unstable with ratatui
c if c > '\u{0700}' => {
output.push(NULL_SYMBOL);