diff --git a/src/common.rs b/src/common.rs index 23197fc..34320c0 100644 --- a/src/common.rs +++ b/src/common.rs @@ -42,7 +42,11 @@ pub fn ucs2_decode(hex_str: &str) -> EyreResult { .map(|c| u16::from_be_bytes([c[0], c[1]])) .collect(); - let str = String::from_utf16(&units)?.into_boxed_str(); + // SMS bodies use CRLF line breaks; a raw \r reaching the terminal + // overwrites the current line. + let str = String::from_utf16(&units)? + .replace('\r', "") + .into_boxed_str(); Ok(str) } diff --git a/src/proc_get.rs b/src/proc_get.rs index aea5fa8..16c0422 100644 --- a/src/proc_get.rs +++ b/src/proc_get.rs @@ -110,7 +110,8 @@ impl Show for SmsInbox { for message in &self.messages { let id = message.id.to_string(); - let content = truncate_chars(message.content.trim(), 24); + let content = message.content.trim().replace('\n', " "); + let content = truncate_chars(&content, 24); let tag = message.tag.to_string(); let date = message.date.to_string();