don't skip leftover string after shortcode

This commit is contained in:
Maciej Jur 2024-04-17 23:40:29 +02:00
parent 279677eb5c
commit 2ae2ee0fd5
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD

View file

@ -115,12 +115,16 @@ fn make_emoji(event: Event) -> Event {
let buf = buf.get_or_insert_with(|| String::with_capacity(text.len())); let buf = buf.get_or_insert_with(|| String::with_capacity(text.len()));
buf.push_str(&text[top..old-1]); buf.push_str(&text[top..old-1]);
buf.push_str(emoji.as_str()); buf.push_str(emoji.as_str());
top = idx; top = idx + 1;
} }
old = idx + 1; old = idx + 1;
} }
if let Some(ref mut buf) = buf {
buf.push_str(&text[top..]);
}
match buf { match buf {
None => event, None => event,
Some(buf) => Event::Text(buf.into()) Some(buf) => Event::Text(buf.into())