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:
parent
1eb6c06ac3
commit
90c5e6c7f9
4 changed files with 13 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue