fix freeze on copy with wl-copy

This commit is contained in:
Remo Senekowitsch 2023-03-05 14:07:47 +01:00 committed by extrawurst
parent 3ceeb33c25
commit 63f230f0d1
2 changed files with 7 additions and 5 deletions

View file

@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* `edit` command duplication ([#1489](https://github.com/extrawurst/gitui/issues/1489))
* syntax errors in `key_bindings.ron` will be logged ([#1491](https://github.com/extrawurst/gitui/issues/1491))
* Fix UI freeze when copying with xclip installed on Linux ([#1497](https://github.com/extrawurst/gitui/issues/1497))
* Fix UI freeze when copying with wl-copy installed on Linux ([#1497](https://github.com/extrawurst/gitui/issues/1497))
* commit hooks report "command not found" on Windows with wsl2 installed ([#1528](https://github.com/extrawurst/gitui/issues/1528))
* crashes on entering submodules ([#1510](https://github.com/extrawurst/gitui/issues/1510))
* fix race issue: revlog messages sometimes appear empty ([#1473](https://github.com/extrawurst/gitui/issues/1473))

View file

@ -49,14 +49,10 @@ fn exec_copy_with_args(
}
}
fn exec_copy(command: &str, text: &str) -> Result<()> {
exec_copy_with_args(command, &[], text, true)
}
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub fn copy_string(text: &str) -> Result<()> {
if std::env::var("WAYLAND_DISPLAY").is_ok() {
return exec_copy("wl-copy", text);
return exec_copy_with_args("wl-copy", &[], text, false);
}
if exec_copy_with_args(
@ -78,6 +74,11 @@ pub fn copy_string(text: &str) -> Result<()> {
Ok(())
}
#[cfg(any(target_os = "macos", windows))]
fn exec_copy(command: &str, text: &str) -> Result<()> {
exec_copy_with_args(command, &[], text, true)
}
#[cfg(target_os = "macos")]
pub fn copy_string(text: &str) -> Result<()> {
exec_copy("pbcopy", text)