diff options
-rw-r--r-- | src/clipboard_store.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/clipboard_store.rs b/src/clipboard_store.rs index 61f53b3..d334dd6 100644 --- a/src/clipboard_store.rs +++ b/src/clipboard_store.rs @@ -6,7 +6,7 @@ use clipboard::ClipboardContext; pub struct ClipboardStore { context: ClipboardContext, - last: String, + original: String, } impl ClipboardStore { @@ -16,15 +16,15 @@ impl ClipboardStore { return Ok( ClipboardStore { context: context, - last: String::new(), + original: String::new(), } ) } pub fn set_contents(&mut self, data: String) -> Result<(), Box<Error>> { - // Save last value - self.last = try!(self.context.get_contents()); - println!("last: {}", self.last); + if self.original.is_empty() { + self.original = try!(self.context.get_contents()) + } // Set new clipboard contents // self.context.set_contents(data) |