diff --git a/src/style.rs b/src/style.rs index fe1160e..2ee9883 100644 --- a/src/style.rs +++ b/src/style.rs @@ -10,21 +10,23 @@ pub fn highlight_difference(suggested_command: &str, last_command: &str) -> Stri if command.is_empty() { continue; } - 'old: for old in split_last_command.clone() { + for old in split_last_command.clone() { if command == &old { old_entries.push(command.clone()); - break 'old; + break; } } } let mut highlighted = suggested_command.to_string(); - for entry in &split_suggested_command { - if old_entries.contains(entry) { - highlighted = highlighted.replace(entry, &entry.cyan().to_string()); - } else { - highlighted = highlighted.replace(entry, &entry.red().bold().to_string()); + 'next: for entry in &split_suggested_command { + for old in &old_entries { + if old == entry { + highlighted = highlighted.replace(entry, &entry.cyan().to_string()); + continue 'next; + } } + highlighted = highlighted.replace(entry, &entry.red().bold().to_string()); } highlighted