-
Notifications
You must be signed in to change notification settings - Fork 699
feat: progress of each task #3121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f636843 to
c3a447c
Compare
sxyazi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this 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 implements real-time progress tracking for file copy operations in the Task window, enhancing user experience by providing visual feedback for long-running I/O operations instead of just showing a static "Copy" message.
- Adds visual progress bars with percentage completion and byte transfer information
- Displays file count progress for directory operations (e.g., "15/100 files")
- Replaces simple table layout with detailed progress visualization using gauges and formatted labels
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| yazi-plugin/preset/components/tasks.lua | Complete redesign of task display with progress bars, file counters, and improved layout |
| yazi-core/src/tasks/tasks.rs | Adjusts task limit calculation to account for expanded 3-line task display |
| yazi-config/preset/theme-*.toml | Updates task hover styling from underline to bold for better visibility |
| yazi-shared/src/url/buf.rs | Minor string formatting improvement using modern Rust syntax |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ((Dimension::available().rows * TASKS_PERCENT / 100) | ||
| .saturating_sub(TASKS_BORDER + TASKS_PADDING) as usize) | ||
| / 3 |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 3 should be defined as a named constant to clarify that it represents the number of lines per task in the new layout. Consider adding const LINES_PER_TASK: usize = 3; and using it here.
| rows[#rows + 1] = ui.Row { snap.name } | ||
| local elements = {} | ||
| for i, snap in ipairs(cx.tasks.snaps) do | ||
| local y = self._area.y + (i - 1) * 3 |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 3 representing lines per task should be extracted as a constant to match the corresponding change in the Rust code and improve maintainability.
Which issue does this PR resolve?
Resolves #3106
Rationale of this PR
The existing task window only provides limited feedback for long-running I/O operations, particularly file copies. When a user copies a large file or directory, the UI only display a static "Copy" message in the task window, offering no insight into the progress.
This PR introduce real-time progress for the copy file operation in the task window
Key Enchancements
Visual Changes
Copy Files
Before

After

Copy Directory
Before

After

Future Work: Transfer Speed and ETA
While the initial goal of #3106 included transfer speed and ETA, this part of the feature has been deferred to a future enhancement to ensure accuracy.
The primary reason is that the current progress tracking is based on the bytes processed within the application's copy loop. This doesn't always reflect the actual disk I/O speed due to factors like OS-level disk caching and buffering. A naive speed calculation could therefore report very high speeds initially (as data is written to a fast memory buffer) that don't represent the true time it will take to flush to disk, leading to a misleading ETA.