aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2016-09-05 02:58:10 -0400
committerTeddy Wing2016-09-05 02:58:10 -0400
commitc1950f087ec24e947ce739875e181ca2ff69f21e (patch)
tree6a8cc5c9407f0c5df2e0680278220e8dde80db24 /src
parent07558bf1a6e681d5492f2e0112d94fd584aa8d0f (diff)
downloadPassextract-c1950f087ec24e947ce739875e181ca2ff69f21e.tar.bz2
ClipboardStore: Rename "last", only set it on first run
* Rename `last` to `original` because we only want to set it the first time we set the clipboard. Subsequent times we set the clipboard contents should not affect this saved value. * Only set `original` on first run of the clipboard `set_contents` function.
Diffstat (limited to 'src')
-rw-r--r--src/clipboard_store.rs10
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)