1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

improved handling of unicode chat messages

This commit is contained in:
Robin Appelman 2020-02-09 16:40:34 +01:00
commit 90c5e6c7f9
4 changed files with 13 additions and 1 deletions

View file

@ -183,7 +183,13 @@ impl BitRead<LittleEndian> for SayText2Message {
// cleanup color codes
let mut text = text.replace(char::from(1), "").replace(char::from(3), "");
while let Some(pos) = text.find(char::from(7)) {
while let Some(pos) = text.chars().enumerate().find_map(|(index, c)| {
if c == char::from(7) {
Some(index)
} else {
None
}
}) {
text = text
.chars()
.take(pos)