Skip to content

Conversation

@sxyazi
Copy link
Owner

@sxyazi sxyazi commented Dec 4, 2025

Fixes #3321

@sxyazi sxyazi requested a review from Copilot December 4, 2025 07:42
Copilot finished reviewing on behalf of sxyazi December 4, 2025 07:44
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 fixes control character escaping in filenames by introducing a new printable character conversion system and improving path handling. The changes replace manual string manipulation with a more robust API and fix several edge cases in path cleaning logic.

  • Introduces replace_to_printable and push_printable_char functions to handle control character escaping with Unicode replacement characters
  • Fixes path cleaning logic to properly track URI/URN counts when removing parent directory references
  • Adds trailing separator normalization to prevent inconsistencies in path handling

Reviewed changes

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

Show a summary per file
File Description
yazi-shared/src/translit/traits.rs Simplifies allocation by removing error handling from reserve_exact call
yazi-shared/src/strand/strand.rs Simplifies allocation by removing error handling from reserve_exact call
yazi-shared/src/strand/conversion.rs Adds AsStrand trait impl for &PathCow<'_> to support borrowed path conversion
yazi-shared/src/path/cow.rs Adds From trait impl for &PathCow<'_> to enable ergonomic conversions
yazi-shared/src/loc/loc.rs Fixes variable reuse bug and adds comprehensive tests for Loc::with
yazi-shared/src/loc/able.rs Adds trailing separator stripping logic for consistent path representation
yazi-shared/src/chars.rs Refactors control character handling into reusable replace_to_printable and push_printable_char functions with Unicode replacement support
yazi-plugin/src/external/highlighter.rs Updates to use new push_printable_char function via merge_highlight_lines helper
yazi-plugin/src/elements/elements.rs Adds printable Lua function to expose control character escaping to plugins
yazi-plugin/preset/components/status.lua Replaces manual carriage return substitution with ui.printable call
yazi-plugin/preset/components/entity.lua Replaces manual carriage return substitution with ui.printable call
yazi-fs/src/path/clean.rs Fixes path component tracking to properly decrement URI/URN counts when popping parent directories
yazi-actor/src/mgr/cd.rs Adds clean_url call to normalize paths after resolution
yazi-actor/src/cmp/trigger.rs Refactors URL splitting logic to use absolute paths and clean_url for consistent path handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sxyazi sxyazi merged commit dccc9b2 into main Dec 4, 2025
9 checks passed
@sxyazi sxyazi deleted the pr-0d5b50a0 branch December 4, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Escape sequences in the displayed UI are not handled and can break the visual output

2 participants