jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.68k stars 105 forks source link

Make OS clipboard support optional. #223

Closed christoph-heiss closed 2 years ago

christoph-heiss commented 3 years ago

This lets the clipboard support depend on a cargo feature flag, which is enabled by default. This means no visible change for normal users.

Disabling OS clipboard support can be useful when using Amp on e.g. Linux servers, which normally do not have libxcb installed. Being able to use Amp in embedded or server environment is very useful, not having to use different editors across different machines.

The clipboard selection mechanism in src/models/application/clipboard/mod.rs was the cleanest way I found to do that. We could use the cfg_if crate to simplify it a bit, but I don't think it would worth for the few lines introduced by this.

I've also updated the clipboard crate, which pulls in a new version of the x11-clipboard crate. This in turn now requires libxcb-xfixes and libxcb-shape to be installed, which required the Travis CI config to be updated. This libraries should be installed on any X11 system out there, so again no visible change.

[ My 2 cents: Travis CI will soon be shutdown, so Amp could/should switch to GitHub actions. I can do that too via a future PR, it shouldn't be much of a hassle. ]

jmacdonald commented 2 years ago

This PR was automatically closed when the master branch was renamed to main. If you'd still like to have these changes reviewed and merged, please re-open this PR against the new main branch! 😁