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

Skip to content

Conversation

@cattyman919
Copy link
Contributor

@cattyman919 cattyman919 commented Aug 29, 2025

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 progress bar, showing percentage of completion based on total byte size.
  • Task view now shows total byes copied vs. total size (e.g., 2.1 GB / 5 GB)
  • When copying directory, UI now displays specific file currently being processed and the overall file count (e.g., "(15/100) Copying video.mp4").
  • The progress polling interval is currently hardcoded with 1 second

Visual Changes

Copy Files

Before
image

After
image

Copy Directory

Before
image

After
image

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.

@sxyazi sxyazi requested a review from Copilot September 4, 2025 10:52
@sxyazi sxyazi changed the title feat: progression status for copy I/O in Task window feat: progress of each task Sep 4, 2025
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

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

Thank you!

@sxyazi sxyazi merged commit 49910fc into sxyazi:main Sep 4, 2025
6 checks passed
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 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.

Comment on lines +57 to +59
((Dimension::available().rows * TASKS_PERCENT / 100)
.saturating_sub(TASKS_BORDER + TASKS_PADDING) as usize)
/ 3
Copy link

Copilot AI Sep 4, 2025

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.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Sep 4, 2025

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.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 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.

Show Copy/Move Progress in Tasks Window

2 participants