From 6d8a5469bdd397e4950c9618a8a801aef5976dc7 Mon Sep 17 00:00:00 2001 From: Hanaasagi Date: Tue, 14 Nov 2023 10:42:05 +0900 Subject: [PATCH] chore: rename `INPUTBOX` and `SELECTBOX` --- yazi-config/src/lib.rs | 8 ++++---- yazi-core/src/manager/commands/open.rs | 6 +++--- yazi-core/src/manager/commands/rename.rs | 8 ++++---- yazi-core/src/tab/commands/cd.rs | 4 ++-- yazi-core/src/tab/commands/find.rs | 4 ++-- yazi-core/src/tab/commands/search.rs | 4 ++-- yazi-core/src/tab/commands/shell.rs | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index a75675d3..0edb2e45 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -33,8 +33,8 @@ pub static PLUGINS: RoCell = RoCell::new(); pub static PREVIEW: RoCell = RoCell::new(); pub static TASKS: RoCell = RoCell::new(); pub static THEME: RoCell = RoCell::new(); -pub static INPUTBOX: RoCell = RoCell::new(); -pub static SELECTBOX: RoCell = RoCell::new(); +pub static INPUT: RoCell = RoCell::new(); +pub static SELECT: RoCell = RoCell::new(); pub static BOOT: RoCell = RoCell::new(); @@ -51,8 +51,8 @@ pub fn init() { PREVIEW.with(Default::default); TASKS.with(Default::default); THEME.with(Default::default); - INPUTBOX.with(Default::default); - SELECTBOX.with(Default::default); + INPUT.with(Default::default); + SELECT.with(Default::default); BOOT.with(Default::default); } diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index c8a635af..e1e5c903 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -1,6 +1,6 @@ use std::ffi::OsString; -use yazi_config::{keymap::Exec, OPEN, SELECTBOX}; +use yazi_config::{keymap::Exec, OPEN, SELECT}; use yazi_shared::MIME_DIR; use crate::{emit, external, manager::Manager, select::SelectOpt}; @@ -23,8 +23,8 @@ impl Manager { let result = emit!(Select(SelectOpt::from_cfg( "Open with:", openers.iter().map(|o| o.desc.clone()).collect(), - &SELECTBOX.open_position, - &SELECTBOX.open_offset + &SELECT.open_position, + &SELECT.open_offset ))); if let Ok(choice) = result.await { diff --git a/yazi-core/src/manager/commands/rename.rs b/yazi-core/src/manager/commands/rename.rs index 15dea8ae..21e886cb 100644 --- a/yazi-core/src/manager/commands/rename.rs +++ b/yazi-core/src/manager/commands/rename.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeSet, ffi::OsStr, io::{stdout, BufWriter, Write}, pat use anyhow::{anyhow, bail, Result}; use tokio::{fs::{self, OpenOptions}, io::{stdin, AsyncReadExt, AsyncWriteExt}}; -use yazi_config::{keymap::Exec, INPUTBOX, OPEN, PREVIEW}; +use yazi_config::{keymap::Exec, INPUT, OPEN, PREVIEW}; use yazi_shared::{max_common_root, Defer, Term, Url}; use crate::{emit, external::{self, ShellOpt}, files::{File, FilesOp}, input::InputOpt, manager::Manager, Event, BLOCKER}; @@ -43,7 +43,7 @@ impl Manager { let opt = opt.into() as Opt; tokio::spawn(async move { let mut result = emit!(Input( - InputOpt::from_cfg("Rename:", &INPUTBOX.rename_position, &INPUTBOX.rename_offset) + InputOpt::from_cfg("Rename:", &INPUT.rename_position, &INPUT.rename_offset) .with_value(hovered.file_name().unwrap().to_string_lossy()) )); @@ -59,8 +59,8 @@ impl Manager { let mut result = emit!(Input(InputOpt::from_cfg( "Overwrite an existing file? (y/N)", - &INPUTBOX.rename_position, - &INPUTBOX.rename_offset + &INPUT.rename_position, + &INPUT.rename_offset ))); if let Some(Ok(choice)) = result.recv().await { if choice == "y" || choice == "Y" { diff --git a/yazi-core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs index 3b6c3d5b..8793b187 100644 --- a/yazi-core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -2,7 +2,7 @@ use std::{mem, time::Duration}; use tokio::{fs, pin}; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; -use yazi_config::{keymap::{Exec, KeymapLayer}, INPUTBOX}; +use yazi_config::{keymap::{Exec, KeymapLayer}, INPUT}; use yazi_shared::{expand_path, Debounce, InputError, Url}; use crate::{emit, input::InputOpt, tab::Tab}; @@ -66,7 +66,7 @@ impl Tab { tokio::spawn(async move { let rx = emit!(Input( - InputOpt::from_cfg("Change directory:", &INPUTBOX.cd_position, &INPUTBOX.cd_offset) + InputOpt::from_cfg("Change directory:", &INPUT.cd_position, &INPUT.cd_offset) .with_value(opt.target.to_string_lossy()) .with_completion() )); diff --git a/yazi-core/src/tab/commands/find.rs b/yazi-core/src/tab/commands/find.rs index 9960bd4c..d70dc462 100644 --- a/yazi-core/src/tab/commands/find.rs +++ b/yazi-core/src/tab/commands/find.rs @@ -2,7 +2,7 @@ use std::time::Duration; use tokio::pin; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; -use yazi_config::{keymap::{Exec, KeymapLayer}, INPUTBOX}; +use yazi_config::{keymap::{Exec, KeymapLayer}, INPUT}; use yazi_shared::{Debounce, InputError}; use crate::{emit, input::InputOpt, tab::{Finder, FinderCase, Tab}}; @@ -41,7 +41,7 @@ impl Tab { tokio::spawn(async move { let title = if opt.prev { "Find previous:" } else { "Find next:" }; let rx = emit!(Input( - InputOpt::from_cfg(title, &INPUTBOX.find_position, &INPUTBOX.find_offset).with_realtime() + InputOpt::from_cfg(title, &INPUT.find_position, &INPUT.find_offset).with_realtime() )); let rx = Debounce::new(UnboundedReceiverStream::new(rx), Duration::from_millis(50)); diff --git a/yazi-core/src/tab/commands/search.rs b/yazi-core/src/tab/commands/search.rs index eaf98968..f2436410 100644 --- a/yazi-core/src/tab/commands/search.rs +++ b/yazi-core/src/tab/commands/search.rs @@ -3,7 +3,7 @@ use std::{mem, time::Duration}; use anyhow::bail; use tokio::pin; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; -use yazi_config::{keymap::{Exec, KeymapLayer}, INPUTBOX}; +use yazi_config::{keymap::{Exec, KeymapLayer}, INPUT}; use crate::{emit, external, files::FilesOp, input::InputOpt, tab::Tab}; @@ -45,7 +45,7 @@ impl Tab { let hidden = self.conf.show_hidden; self.search = Some(tokio::spawn(async move { - let Some(Ok(subject)) = emit!(Input(InputOpt::from_cfg("Search:", &INPUTBOX.cd_position, &INPUTBOX.cd_offset))).recv().await else { + let Some(Ok(subject)) = emit!(Input(InputOpt::from_cfg("Search:", &INPUT.cd_position, &INPUT.cd_offset))).recv().await else { bail!("") }; diff --git a/yazi-core/src/tab/commands/shell.rs b/yazi-core/src/tab/commands/shell.rs index 926d4faa..123678db 100644 --- a/yazi-core/src/tab/commands/shell.rs +++ b/yazi-core/src/tab/commands/shell.rs @@ -1,4 +1,4 @@ -use yazi_config::{keymap::Exec, open::Opener, INPUTBOX}; +use yazi_config::{keymap::Exec, open::Opener, INPUT}; use crate::{emit, input::InputOpt, tab::Tab}; @@ -31,7 +31,7 @@ impl Tab { if !opt.confirm || opt.cmd.is_empty() { let title = if opt.block { "Shell (block):" } else { "Shell:" }; let mut result = emit!(Input( - InputOpt::from_cfg(title, &INPUTBOX.shell_position, &INPUTBOX.shell_offset) + InputOpt::from_cfg(title, &INPUT.shell_position, &INPUT.shell_offset) .with_value(opt.cmd) .with_highlight() ));