avoid ever setting split_at to 0

This commit is contained in:
spqrz 2026-04-12 08:43:10 +01:00
parent d5aad5c1a4
commit b23f6484e2
No known key found for this signature in database

View file

@ -260,7 +260,7 @@ impl State {
while i > 0 && !remaining.is_char_boundary(i) { i -= 1; } while i > 0 && !remaining.is_char_boundary(i) { i -= 1; }
// To avoid splitting mid-word, see if there was a space recently // To avoid splitting mid-word, see if there was a space recently
let mut j = i; let mut j = i;
while j > 0 && j > i-10 && remaining.as_bytes()[j] != b' ' { j -= 1; } while j > 1 && j > i-10 && remaining.as_bytes()[j] != b' ' { j -= 1; }
if remaining.as_bytes()[j] == b' ' { j } if remaining.as_bytes()[j] == b' ' { j }
else if i == 0 { max_msg } else { i } else if i == 0 { max_msg } else { i }
}; };