mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 09:18:08 +02:00
implement move deletion and add tests for dnd kitten drop
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/e2238746-2319-43e5-9b01-4899e7f06b50 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9a3f3ed14e
commit
fe6807c9b0
@@ -449,8 +449,21 @@ func (dnd *dnd) end_drop(success bool) {
|
||||
if dnd.drop_status.reading_data {
|
||||
dnd.lp.QueueDnDData(DC{
|
||||
Type: 'r', Operation: utils.IfElse(success, dnd.drop_status.action, 0)}) // end drop
|
||||
if success && dnd.drop_status.action == 2 && !dnd.drop_status.is_remote_client {
|
||||
// TODO: delete all dropped files/dirs/symlinks after successful move
|
||||
if success && dnd.drop_status.action == move_on_drop && !dnd.drop_status.is_remote_client {
|
||||
for _, path := range dnd.drop_status.uri_list {
|
||||
if path == "" {
|
||||
continue
|
||||
}
|
||||
st, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if st.IsDir() {
|
||||
os.RemoveAll(path)
|
||||
} else {
|
||||
os.Remove(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dnd.reset_drop()
|
||||
|
||||
Reference in New Issue
Block a user