fix: reset the cursor position with arrow() after deleting files (#2708)

This commit is contained in:
三咲雅 · Misaki Masa 2025-05-02 02:35:19 +08:00 committed by GitHub
parent 9037f8b8c0
commit 01a13fd664
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,7 +70,8 @@ impl Folder {
FilesOp::Creating(_, files) => self.files.update_creating(files),
FilesOp::Deleting(_, urns) => {
let deleted = self.files.update_deleting(urns);
self.cursor -= deleted.into_iter().filter(|&i| i < self.cursor).count();
let delta = deleted.into_iter().filter(|&i| i < self.cursor).count() as isize;
self.arrow(-delta);
}
FilesOp::Updating(_, files) => _ = self.files.update_updating(files),
FilesOp::Upserting(_, files) => self.files.update_upserting(files),