diff options
author | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
commit | 63f18140d6e77490844559cdda5f8158a0e2fc48 (patch) | |
tree | c60d96dd180610aaa30c3e3fbde76ac818a8fede | |
parent | working? (diff) | |
download | hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.gz hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.bz2 hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.xz hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.zst hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.zip |
delettin
-rw-r--r-- | i_events.go | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/i_events.go b/i_events.go index 980bd83..f52e9fe 100644 --- a/i_events.go +++ b/i_events.go @@ -175,34 +175,28 @@ func i_reload_data(data *HardData) { } func i_delete_dir(data *HardData) { - dir := data.litems.curr.Dirs - if dir == nil { + if data.litems.curr == nil || data.litems.curr.Dirs == nil { return } - // dir_path := data.data_dir + dir.path() - - // if err := os.RemoveAll(dir_path); err != nil { - // data.ui.s.Fini() - // c_die("can't remove " + dir_path, err) - // } - tmp := data.litems.curr.prev - // count := data.litems.curr.Dirs.count_elements(false, data.folds) + 1 - count := 0 - data.ldirs.del(data.litems.curr.Dirs) - for i := 0; data.litems.curr != nil && i < count; i++ { - data.litems.del(data.litems.curr) - data.litems.curr = data.litems.curr.next + if data.folds[data.litems.curr.Dirs] == nil { + i_fold_dir(data, data.litems.curr) } - if tmp == nil { - tmp = data.litems.head + delete(data.folds, data.litems.curr.Dirs) + if data.litems.last == data.litems.curr { + data.litems.last = data.litems.curr.prev } - data.litems.curr = tmp - if data.litems.last != nil { - data.ui.sel_max = data.litems.last.ID - } else { - data.ui.sel_max = 0 + data.litems.curr.prev = data.litems.curr.next + data.litems.curr.next = data.litems.curr.prev + data.litems.curr = data.litems.curr.next + for ptr := data.litems.head; ptr.next != nil; ptr = ptr.next { + ptr.next.ID = ptr.ID + 1 } - // TODO: delete folds map reference if folded + // dir_path := data.data_dir + dir.path() + // if err := os.RemoveAll(dir_path); err != nil { + // data.ui.s.Fini() + // c_die("can't remove " + dir_path, err) + // } + // TODO: delete folds map reference if folded - OK // TEST: single empty dir // TEST: single non-empty dir // TEST: first dir |