Fixes for the upstream merge

This commit is contained in:
Carlos de Paula 2026-01-04 19:31:29 -03:00
parent 712823cf5b
commit 8ef7e1f2b9
No known key found for this signature in database
5 changed files with 16 additions and 16 deletions

View file

@ -7,7 +7,7 @@ use yazi_core::tab::Folder;
use yazi_fs::{FolderStage, IgnoreFilter};
use yazi_macro::{act, render, render_and, succ};
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};
@ -28,12 +28,12 @@ impl Actor for ExcludeAdd {
let cwd_str = if cwd.is_search() {
"search://**".to_string()
} 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
// 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
let mut test_builder = GlobSetBuilder::new();
for pattern in &opt.patterns {
@ -154,7 +154,7 @@ impl Actor for ExcludeAdd {
// Load ignore filter with merged patterns
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 changed = f.files.set_ignore_filter(filter);
if f.stage == FolderStage::Loading {
@ -172,7 +172,7 @@ impl Actor for ExcludeAdd {
let parent_str = if p.url.is_search() {
"search://**".to_string()
} 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);
@ -265,7 +265,7 @@ impl Actor for ExcludeAdd {
let hovered_str = if h.url.is_search() {
"search://**".to_string()
} 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);

View file

@ -3,7 +3,7 @@ use yazi_core::tab::Folder;
use yazi_fs::FolderStage;
use yazi_macro::{act, render, render_and, succ};
use yazi_parser::mgr::ExcludedOpt;
use yazi_shared::{data::Data, path::PathLike};
use yazi_shared::data::Data;
use crate::{Actor, Ctx};
@ -18,7 +18,7 @@ impl Actor for Excluded {
let current_state = cx.tab().current.files.show_excluded();
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| {
if f.stage == FolderStage::Loading {
render!();

View file

@ -6,7 +6,7 @@ use yazi_core::tab::Folder;
use yazi_fs::{FolderStage, IgnoreFilter};
use yazi_macro::{act, render, render_and, succ};
use yazi_parser::VoidOpt;
use yazi_shared::{data::Data, path::PathLike, url::UrlLike};
use yazi_shared::{data::Data, url::UrlLike};
use crate::{Actor, Ctx};
@ -24,14 +24,14 @@ impl Actor for Ignore {
let cwd_str = if cwd.is_search() {
"search://**".to_string()
} 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);
// Check if we're inside an excluded directory
// 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?
for pattern in &exclude_patterns {
if pattern.starts_with('!') {
@ -62,7 +62,7 @@ impl Actor for Ignore {
// Load ignore filter from exclude patterns
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>| {
// Always set the filter, even when loading
let changed = f.files.set_ignore_filter(filter);
@ -81,7 +81,7 @@ impl Actor for Ignore {
let parent_str = if p.url.is_search() {
"search://**".to_string()
} 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);
@ -109,7 +109,7 @@ impl Actor for Ignore {
let hovered_str = if h.url.is_search() {
"search://**".to_string()
} 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_matcher: Option<Arc<dyn Fn(&std::path::Path) -> Option<bool> + Send + Sync>> =

View file

@ -59,7 +59,7 @@ impl IgnoreFilter {
/// Returns true if matched as ignore, false if whitelisted or no match.
pub fn matches_url(&self, url: impl AsUrl) -> bool {
let url = url.as_url();
let path = url.loc.as_path();
let Ok(path) = url.loc().as_os() else { return false };
// Check glob matcher
if let Some(ref matcher) = self.glob_matcher {

View file

@ -162,7 +162,7 @@ impl UrlBuf {
Self::Archive { loc, domain } => {
Self::Archive { loc: loc.rebase(base), domain: domain.clone() }
}
Self::Sftp { loc, domain } => {
Self::Sftp { loc: _, domain: _ } => {
todo!();
// Self::Sftp { loc: loc.rebase(base), domain: domain.clone() }
}