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:
copilot-swe-agent[bot]
2026-05-05 09:37:50 +00:00
committed by GitHub
parent 9a3f3ed14e
commit fe6807c9b0
2 changed files with 48 additions and 2 deletions

View File

@@ -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()