Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sxyazi
Copy link
Owner

@sxyazi sxyazi commented Jun 24, 2025

An implementation of the feature request: #2565, #2894


The search view flatly shows search results, for example, a/b/c.txt, where a/b is the prefix and c.txt is the file name.

Previously, users could only use the filter command to filter for the file name portion (c.txt) within the search results.

With this PR, the full path a/b/c.txt can now be filtered, which makes it more intuitive, as users should be able to filter for the path as they see it in the list, rather than only the final part of it.

1.mp4

@sxyazi sxyazi requested a review from Copilot June 24, 2025 05:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables filtering search results by the full path (prefix/filename) instead of only the filename.

  • Implements AsRef<OsStr> for Urn to allow matching on the complete path.
  • Updates all partition(... filter.matches(...)) calls in Files to use u.as_urn() (full path) rather than .name().

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
yazi-shared/src/url/urn.rs Add AsRef<OsStr> impl on Urn for path matching
yazi-fs/src/files.rs Change filter logic to use full Urn instead of name
Comments suppressed due to low confidence (2)

yazi-fs/src/files.rs:191

  • Add unit tests to verify that filtering by the full path (including directory prefixes) works as intended, covering both matching and non-matching scenarios.
				.partition(|u| (!self.show_hidden && u.as_urn().is_hidden()) || !filter.matches(u.as_urn()))

yazi-shared/src/url/urn.rs:39

  • [nitpick] Consider adding a doc comment explaining why AsRef<OsStr> is implemented for Urn (e.g., to support full-path filtering in the search view).
impl AsRef<OsStr> for Urn {

@sxyazi sxyazi merged commit e218f1d into main Jun 24, 2025
6 checks passed
@sxyazi sxyazi deleted the pr-dce49c6b branch June 24, 2025 05:29
xeysz pushed a commit to xeysz/yazi that referenced this pull request Jun 27, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants