From 874d653d420ea98680dd820f3bdd60afb3931747 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 6 Aug 2016 20:43:09 -0400 Subject: strip_key: Fix for values that contain ": " Values that contained ": " would not be parsed correctly for copying to the clipboard. If, for example, a password contained ": ", those characters and any following them wouldn't be copied. This change allows such passwords to be copied correctly. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 37ddb5e..c09eb4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,9 +29,9 @@ struct Point { /// let value = strip_key("e: email@example.com"); /// assert_eq!(value, "email@example.com"); /// ``` -fn strip_key(line: &str) -> &str { +fn strip_key(line: &str) -> String { let strings: Vec<&str> = line.split(": ").collect(); - strings[1] + strings[1..].join(": ") } fn move_selection(term: &mut Terminal, selection: &mut Point, style: Cell, amount: isize) { -- cgit v1.2.3