-
Notifications
You must be signed in to change notification settings - Fork 442
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
feat: add new move
, trash
, and delete
event kinds to DDS
#880
feat: add new move
, trash
, and delete
event kinds to DDS
#880
Conversation
Thanks for the PR! Could you create a new event type |
Sure! |
42ecaec
to
edb2840
Compare
@@ -21,6 +22,12 @@ impl Manager { | |||
if self.yanked.cut { | |||
tasks.file_cut(&src, dest, opt.force); | |||
|
|||
src.iter().for_each(|source_file| { |
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.
I think it should be moved to the scheduler,
yazi/yazi-scheduler/src/file/file.rs
Line 28 in 357f87a
FileOp::Paste(mut task) => { |
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.
I like this idea. I tried implementing it but ran into some issues and could use some help.
Issue 1
In the scheduler I don't seem to have access to the current tab though. The tab is present in the rename event, and I think it would need some refactoring to get access to the current tab.
Issue 2
Publishing events from the scheduler doesn't cause the events to be visible for me. I pushed the commit 410bf4a as a work-in-progress commit to show what I tried.
I could not figure this out. Any ideas on what could be done?
Thanks for the work you've done so far; I'll finish the remaining part. |
Thanks, I appreciate that! I also tried to add support for a new I kinda ran into the same issue - it seemed like it's possible to request the scheduler to delete files, but I couldn't see if it's possible to know if the request has been successfully completed or not. Maybe this is a feature that's not implemented yet? It could also be that I missed it. |
Co-authored-by: 三咲雅 · Misaki Masa <sxyazi@gmail.com>
NOTE: this removes the "tab" key from the event, as the tab is not currently passed to the scheduler and it seemed like a bigger change to do right now.
410bf4a
to
63b20ba
Compare
move
and delete
event kinds to DDS
Yeah it seems to work! As a suggestion, I also added sending a |
yazi-scheduler/src/scheduler.rs
Outdated
@@ -174,7 +174,8 @@ impl Scheduler { | |||
let file = self.file.clone(); | |||
_ = self.micro.try_send( | |||
async move { | |||
file.trash(FileOpTrash { id, target, length: 0 }).await.ok(); | |||
file.trash(FileOpTrash { id, target: target.clone(), length: 0 }).await.ok(); | |||
Pump::push_delete(target); |
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.
I don't really like adding trash
to delete
because they're two different concepts, I think it deserves a new trash
event kind.
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.
Ok, I'll add a new event kind. It should be much simpler after the latest changes.
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.
Thanks, let me do some minor refactors |
move
and delete
event kinds to DDSmove
, trash
, and delete
event kinds to DDS
All looks good to me now, let me merge it now. Thank you so much for contributing to this feature! |
Previously, only the rename command sent
rename
events. Now a cut and paste operation also sends events.Demo:
yazi-rename.mov