Merge #1031: Treat U+2007 FIGURE SPACE as non-breaking in line breaking (@Silvertree2010)

This commit is contained in:
bflatastic
2026-10-24 09:23:18 +07:00
+13 -1
View File
@@ -39,7 +39,7 @@ fn class(c: char) -> Class {
return Class::Close;
}
match c {
' ' | '\t' | '\u{3000}' | '\u{2002}'..='\u{200B}' => Class::Space,
' ' | '\t' | '\u{3000}' | '\u{2002}'..='\u{2006}' | '\u{2008}'..='\u{200B}' => Class::Space,
'-' | '/' | '\u{2010}' | '\u{2013}' | '\u{2014}' => Class::Hyphen,
'\u{2E80}'..='\u{2FFF}'
| '\u{3003}'..='\u{33FF}'
@@ -98,3 +98,15 @@ pub fn grapheme_step(text: &str, index: usize, forward: bool) -> usize {
}
at.min(index)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn figure_space_is_non_breaking() {
assert!(!break_between('\u{2007}', '0'));
assert!(!break_between('1', '\u{2007}'));
assert!(!is_space('\u{2007}'));
}
}