From b99121472921c77b259a997f7ee3ed0305d749b1 Mon Sep 17 00:00:00 2001 From: iff Date: Wed, 9 Aug 2023 23:24:15 +0200 Subject: [PATCH] fix: incorrect multiline highligting --- src/style.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/style.rs b/src/style.rs index e05bb91..16860e0 100644 --- a/src/style.rs +++ b/src/style.rs @@ -9,7 +9,7 @@ pub fn highlight_difference( suggested_command: &str, last_command: &str, ) -> Option { - let replaced_newline = suggested_command.replace('\n', r" {{newline}}"); + let replaced_newline = suggested_command.replace('\n', r" {{newline}} "); let mut split_suggested_command = split_command(&replaced_newline); let split_last_command = split_command(last_command); @@ -34,7 +34,7 @@ pub fn highlight_difference( // let mut highlighted = suggested_command.to_string(); 'next: for entry in split_suggested_command.iter_mut() { - if entry == r"{{newline}" { + if entry == r"{{newline}}" { continue; } for old in &old_entries { @@ -62,5 +62,5 @@ pub fn highlight_difference( highlighted = split_suggested_command.join(" "); } - Some(highlighted.replace(r"{{newline}}", "\n")) + Some(highlighted.replace(r" {{newline}} ", "\n")) }