aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
commit63f18140d6e77490844559cdda5f8158a0e2fc48 (patch)
treec60d96dd180610aaa30c3e3fbde76ac818a8fede /i_events.go
parentworking? (diff)
downloadhardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.gz
hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.bz2
hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.xz
hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.tar.zst
hardflip-63f18140d6e77490844559cdda5f8158a0e2fc48.zip
delettin
Diffstat (limited to 'i_events.go')
-rw-r--r--i_events.go40
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