From dafea56be900834e7b216dfa8a79caae0117611e Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Wed, 21 Feb 2018 10:42:03 +0000 Subject: [PATCH] Fix /me message mangling. On messages like "/me foo /me" it would replace all occurencies of "/me" with an empty string. Instead this trims only the "Left" parts of the message. Left as defined in the `.trim_left_matches()` method of `str`in the rustdocs. --- fractal-gtk/src/app.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fractal-gtk/src/app.rs b/fractal-gtk/src/app.rs index a115bbf6..362be437 100644 --- a/fractal-gtk/src/app.rs +++ b/fractal-gtk/src/app.rs @@ -1242,8 +1242,8 @@ impl AppOp { id: None, }; - if msg.starts_with("/me") { - m.body = msg.replace("/me ", ""); + if msg.starts_with("/me ") { + m.body = msg.trim_left_matches("/me ").to_owned(); m.mtype = strn!("m.emote"); };