Panics · P06 Forms: roots, stale selections, shaping faults and gone units log instead of panicking; cron runs say UTC in an unknown zone

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 16:49:35 -04:00
1 parent 73a8bf2e34
commit e2d880fb4f
8 files changed
+160 -53

No files matched your search

+11 -5
View File
@@ -266,12 +266,18 @@ impl TextInput {
self.replace(self.selection.clone(), text, false, cx);
}
/// Selects `range`; one outside the text or inside a character is logged and left.
pub fn select(&mut self, range: Range<usize>, cx: &mut Context<Self>) {
assert!(
range.start <= range.end && range.end <= self.text.len(),
"selection {range:?} is outside {} bytes",
self.text.len()
);
let fits = range.start <= range.end
&& self.text.is_char_boundary(range.start)
&& self.text.is_char_boundary(range.end);
if !fits {
log::error!(
"text input: no selection {range:?} in {} bytes",
self.text.len()
);
return;
}
self.selection = range;
self.reversed = false;
self.restart_blink(cx);