mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
c606e7f08c
commit
7edf721daf
4 changed files with 7 additions and 11 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -2762,7 +2762,6 @@ name = "yazi-core"
|
|||
version = "0.2.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.0",
|
||||
"bitflags 2.5.0",
|
||||
"crossterm",
|
||||
"futures",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ yazi-shared = { path = "../yazi-shared", version = "0.2.5" }
|
|||
|
||||
# External dependencies
|
||||
anyhow = "1.0.82"
|
||||
base64 = "0.22.0"
|
||||
bitflags = "2.5.0"
|
||||
crossterm = "0.27.0"
|
||||
futures = "0.3.30"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pub mod bindings;
|
||||
mod cast;
|
||||
pub mod clipboard;
|
||||
mod clipboard;
|
||||
mod config;
|
||||
pub mod elements;
|
||||
pub mod external;
|
||||
|
|
@ -25,7 +25,8 @@ pub use opt::*;
|
|||
pub use runtime::*;
|
||||
|
||||
pub fn init() {
|
||||
CLIPBOARD.with(Default::default);
|
||||
|
||||
crate::loader::init();
|
||||
crate::init_lua();
|
||||
CLIPBOARD.with(Default::default);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,15 +34,12 @@ impl Utils {
|
|||
|
||||
ya.raw_set(
|
||||
"clipboard",
|
||||
lua.create_async_function(|lua, text: mlua::String| async move {
|
||||
let text = text.to_string_lossy().into_owned();
|
||||
|
||||
if text.is_empty() {
|
||||
let clipboard_data = CLIPBOARD.get().await;
|
||||
Some(lua.create_string(clipboard_data.as_encoded_bytes())).transpose()
|
||||
} else {
|
||||
lua.create_async_function(|lua, text: Option<String>| async move {
|
||||
if let Some(text) = text {
|
||||
CLIPBOARD.set(text).await;
|
||||
Ok(None)
|
||||
} else {
|
||||
Some(lua.create_string(CLIPBOARD.get().await.as_encoded_bytes())).transpose()
|
||||
}
|
||||
})?,
|
||||
)?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue