preserve the current clipboard when using the Clipboard backend.

Store the current clipboard and restore it after the expansion has been
pasted.
This prevents your current clipboard from being lost if using the
Clipboard backend.
This commit is contained in:
Matt Harrison 2019-12-11 12:12:40 -05:00
parent 7e2c6ac7ff
commit 92d99c30bc
No known key found for this signature in database
GPG Key ID: D2C220A71DA3C135

View File

@ -205,8 +205,10 @@ impl <'a, S: KeyboardManager, C: ClipboardManager, M: ConfigManager<'a>, U: UIMa
}
},
BackendType::Clipboard => {
let previous_clipboard_content = self.clipboard_manager.get_clipboard().unwrap_or(String::from(""));
self.clipboard_manager.set_clipboard(&target_string);
self.keyboard_manager.trigger_paste(&config.paste_shortcut);
self.clipboard_manager.set_clipboard(&previous_clipboard_content);
},
}