mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Fixes for the upstream merge
This commit is contained in:
parent
712823cf5b
commit
8ef7e1f2b9
5 changed files with 16 additions and 16 deletions
|
|
@ -7,7 +7,7 @@ use yazi_core::tab::Folder;
|
||||||
use yazi_fs::{FolderStage, IgnoreFilter};
|
use yazi_fs::{FolderStage, IgnoreFilter};
|
||||||
use yazi_macro::{act, render, render_and, succ};
|
use yazi_macro::{act, render, render_and, succ};
|
||||||
use yazi_parser::mgr::ExcludeAddOpt;
|
use yazi_parser::mgr::ExcludeAddOpt;
|
||||||
use yazi_shared::{data::Data, path::PathLike, url::UrlLike};
|
use yazi_shared::{data::Data, url::UrlLike};
|
||||||
|
|
||||||
use crate::{Actor, Ctx};
|
use crate::{Actor, Ctx};
|
||||||
|
|
||||||
|
|
@ -28,12 +28,12 @@ impl Actor for ExcludeAdd {
|
||||||
let cwd_str = if cwd.is_search() {
|
let cwd_str = if cwd.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
cwd.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
cwd.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if the current folder itself is matched by any of the patterns
|
// Check if the current folder itself is matched by any of the patterns
|
||||||
// If so, don't apply the filter - we're viewing inside a gitignored directory
|
// If so, don't apply the filter - we're viewing inside a gitignored directory
|
||||||
if let Some(cwd_path) = cwd.as_path() {
|
if let Some(cwd_path) = cwd.loc().as_os().ok() {
|
||||||
// Build a quick GlobSet to test if current folder matches any pattern
|
// Build a quick GlobSet to test if current folder matches any pattern
|
||||||
let mut test_builder = GlobSetBuilder::new();
|
let mut test_builder = GlobSetBuilder::new();
|
||||||
for pattern in &opt.patterns {
|
for pattern in &opt.patterns {
|
||||||
|
|
@ -154,7 +154,7 @@ impl Actor for ExcludeAdd {
|
||||||
// Load ignore filter with merged patterns
|
// Load ignore filter with merged patterns
|
||||||
let ignore_filter = IgnoreFilter::from_patterns(glob_matcher.clone());
|
let ignore_filter = IgnoreFilter::from_patterns(glob_matcher.clone());
|
||||||
|
|
||||||
let hovered = cx.hovered().map(|f| f.urn().owned());
|
let hovered = cx.hovered().map(|f| f.urn().to_owned());
|
||||||
let apply = |f: &mut Folder, filter: Option<IgnoreFilter>| {
|
let apply = |f: &mut Folder, filter: Option<IgnoreFilter>| {
|
||||||
let changed = f.files.set_ignore_filter(filter);
|
let changed = f.files.set_ignore_filter(filter);
|
||||||
if f.stage == FolderStage::Loading {
|
if f.stage == FolderStage::Loading {
|
||||||
|
|
@ -172,7 +172,7 @@ impl Actor for ExcludeAdd {
|
||||||
let parent_str = if p.url.is_search() {
|
let parent_str = if p.url.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
p.url.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
p.url.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let parent_config_patterns = YAZI.files.excludes_for_context(&parent_str);
|
let parent_config_patterns = YAZI.files.excludes_for_context(&parent_str);
|
||||||
|
|
@ -265,7 +265,7 @@ impl Actor for ExcludeAdd {
|
||||||
let hovered_str = if h.url.is_search() {
|
let hovered_str = if h.url.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
h.url.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
h.url.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let hovered_config_patterns = YAZI.files.excludes_for_context(&hovered_str);
|
let hovered_config_patterns = YAZI.files.excludes_for_context(&hovered_str);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use yazi_core::tab::Folder;
|
||||||
use yazi_fs::FolderStage;
|
use yazi_fs::FolderStage;
|
||||||
use yazi_macro::{act, render, render_and, succ};
|
use yazi_macro::{act, render, render_and, succ};
|
||||||
use yazi_parser::mgr::ExcludedOpt;
|
use yazi_parser::mgr::ExcludedOpt;
|
||||||
use yazi_shared::{data::Data, path::PathLike};
|
use yazi_shared::data::Data;
|
||||||
|
|
||||||
use crate::{Actor, Ctx};
|
use crate::{Actor, Ctx};
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ impl Actor for Excluded {
|
||||||
let current_state = cx.tab().current.files.show_excluded();
|
let current_state = cx.tab().current.files.show_excluded();
|
||||||
let state = opt.state.bool(current_state);
|
let state = opt.state.bool(current_state);
|
||||||
|
|
||||||
let hovered = cx.hovered().map(|f| f.urn().owned());
|
let hovered = cx.hovered().map(|f| f.urn().to_owned());
|
||||||
let apply = |f: &mut Folder| {
|
let apply = |f: &mut Folder| {
|
||||||
if f.stage == FolderStage::Loading {
|
if f.stage == FolderStage::Loading {
|
||||||
render!();
|
render!();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use yazi_core::tab::Folder;
|
||||||
use yazi_fs::{FolderStage, IgnoreFilter};
|
use yazi_fs::{FolderStage, IgnoreFilter};
|
||||||
use yazi_macro::{act, render, render_and, succ};
|
use yazi_macro::{act, render, render_and, succ};
|
||||||
use yazi_parser::VoidOpt;
|
use yazi_parser::VoidOpt;
|
||||||
use yazi_shared::{data::Data, path::PathLike, url::UrlLike};
|
use yazi_shared::{data::Data, url::UrlLike};
|
||||||
|
|
||||||
use crate::{Actor, Ctx};
|
use crate::{Actor, Ctx};
|
||||||
|
|
||||||
|
|
@ -24,14 +24,14 @@ impl Actor for Ignore {
|
||||||
let cwd_str = if cwd.is_search() {
|
let cwd_str = if cwd.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
cwd.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
cwd.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let exclude_patterns = YAZI.files.excludes_for_context(&cwd_str);
|
let exclude_patterns = YAZI.files.excludes_for_context(&cwd_str);
|
||||||
|
|
||||||
// Check if we're inside an excluded directory
|
// Check if we're inside an excluded directory
|
||||||
// If so, don't apply filters to allow viewing excluded directory contents
|
// If so, don't apply filters to allow viewing excluded directory contents
|
||||||
if let Some(cwd_path) = cwd.as_path() {
|
if let Some(cwd_path) = cwd.loc().as_os().ok() {
|
||||||
// Quick test: does the CWD match any exclude pattern?
|
// Quick test: does the CWD match any exclude pattern?
|
||||||
for pattern in &exclude_patterns {
|
for pattern in &exclude_patterns {
|
||||||
if pattern.starts_with('!') {
|
if pattern.starts_with('!') {
|
||||||
|
|
@ -62,7 +62,7 @@ impl Actor for Ignore {
|
||||||
// Load ignore filter from exclude patterns
|
// Load ignore filter from exclude patterns
|
||||||
let ignore_filter = IgnoreFilter::from_patterns(glob_matcher.clone());
|
let ignore_filter = IgnoreFilter::from_patterns(glob_matcher.clone());
|
||||||
|
|
||||||
let hovered = cx.hovered().map(|f| f.urn().owned());
|
let hovered = cx.hovered().map(|f| f.urn().to_owned());
|
||||||
let apply = |f: &mut Folder, filter: Option<IgnoreFilter>| {
|
let apply = |f: &mut Folder, filter: Option<IgnoreFilter>| {
|
||||||
// Always set the filter, even when loading
|
// Always set the filter, even when loading
|
||||||
let changed = f.files.set_ignore_filter(filter);
|
let changed = f.files.set_ignore_filter(filter);
|
||||||
|
|
@ -81,7 +81,7 @@ impl Actor for Ignore {
|
||||||
let parent_str = if p.url.is_search() {
|
let parent_str = if p.url.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
p.url.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
p.url.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let parent_excludes = YAZI.files.excludes_for_context(&parent_str);
|
let parent_excludes = YAZI.files.excludes_for_context(&parent_str);
|
||||||
|
|
@ -109,7 +109,7 @@ impl Actor for Ignore {
|
||||||
let hovered_str = if h.url.is_search() {
|
let hovered_str = if h.url.is_search() {
|
||||||
"search://**".to_string()
|
"search://**".to_string()
|
||||||
} else {
|
} else {
|
||||||
h.url.as_path().map(|p| p.display().to_string()).unwrap_or_default()
|
h.url.loc().as_os().ok().map(|p| p.display().to_string()).unwrap_or_default()
|
||||||
};
|
};
|
||||||
let hovered_excludes = YAZI.files.excludes_for_context(&hovered_str);
|
let hovered_excludes = YAZI.files.excludes_for_context(&hovered_str);
|
||||||
let hovered_matcher: Option<Arc<dyn Fn(&std::path::Path) -> Option<bool> + Send + Sync>> =
|
let hovered_matcher: Option<Arc<dyn Fn(&std::path::Path) -> Option<bool> + Send + Sync>> =
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ impl IgnoreFilter {
|
||||||
/// Returns true if matched as ignore, false if whitelisted or no match.
|
/// Returns true if matched as ignore, false if whitelisted or no match.
|
||||||
pub fn matches_url(&self, url: impl AsUrl) -> bool {
|
pub fn matches_url(&self, url: impl AsUrl) -> bool {
|
||||||
let url = url.as_url();
|
let url = url.as_url();
|
||||||
let path = url.loc.as_path();
|
let Ok(path) = url.loc().as_os() else { return false };
|
||||||
|
|
||||||
// Check glob matcher
|
// Check glob matcher
|
||||||
if let Some(ref matcher) = self.glob_matcher {
|
if let Some(ref matcher) = self.glob_matcher {
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ impl UrlBuf {
|
||||||
Self::Archive { loc, domain } => {
|
Self::Archive { loc, domain } => {
|
||||||
Self::Archive { loc: loc.rebase(base), domain: domain.clone() }
|
Self::Archive { loc: loc.rebase(base), domain: domain.clone() }
|
||||||
}
|
}
|
||||||
Self::Sftp { loc, domain } => {
|
Self::Sftp { loc: _, domain: _ } => {
|
||||||
todo!();
|
todo!();
|
||||||
// Self::Sftp { loc: loc.rebase(base), domain: domain.clone() }
|
// Self::Sftp { loc: loc.rebase(base), domain: domain.clone() }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue