make sharing to clipboard a feature that can be disabled

this is for users that want to eliminate dependences (e.g. libxcb).
the feature is enabled by default and must be explicitly disabled.

fixes #84
This commit is contained in:
Henrik Friedrichsen
2019-08-13 11:48:42 +02:00
parent 9664882cdb
commit f7458b4137
4 changed files with 14 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ use cursive::view::ScrollBase;
use cursive::{Cursive, Printer, Rect, Vec2};
use unicode_width::UnicodeWidthStr;
#[cfg(feature = "share_clipboard")]
use clipboard::{ClipboardContext, ClipboardProvider};
use command::{Command, GotoMode, MoveMode, TargetMode};
use commands::CommandResult;
@@ -321,6 +322,7 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
};
if let Some(url) = url {
#[cfg(feature = "share_clipboard")]
ClipboardProvider::new()
.and_then(|mut ctx: ClipboardContext| ctx.set_contents(url))
.ok();