diff options
author | Joe <rbo@gmx.us> | 2024-01-11 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-11 20:20:20 +0100 |
commit | ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8 (patch) | |
tree | adb630564b940470b01931cc46f103ab4179a381 | |
parent | cool (diff) | |
download | hardflip-ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8.tar.gz hardflip-ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8.tar.bz2 hardflip-ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8.tar.xz hardflip-ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8.tar.zst hardflip-ddb6cdc8b9e723dd89b2dbb81b30c282dbc685c8.zip |
gogo
-rw-r--r-- | c_ldirs.go | 2 | ||||
-rw-r--r-- | i_events.go | 23 | ||||
-rw-r--r-- | i_ui.go | 15 |
3 files changed, 29 insertions, 11 deletions
@@ -163,6 +163,8 @@ func (dir *DirsNode) count_elements(skip_folds bool) int { for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next { if skip_folds == true && ptr.Folded == true { items += 1 + // HACK: key to the map is the key + // TODO: fix you shit } else { items += ptr.count_hosts() + 1 } diff --git a/i_events.go b/i_events.go index 9333cfd..99907cf 100644 --- a/i_events.go +++ b/i_events.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_events.go - * Wed Jan 10 18:56:02 2024 + * Thu Jan 11 12:22:12 2024 * Joe * * events in the code @@ -114,7 +114,7 @@ func i_fold_dir(data *HardData, item *ItemsNode) { } else { folded_end = nil } - for i := 0; folded_end != nil && i < item.Dirs.count_elements(true); i++ { + for i := 0; folded_end != nil && i < item.Dirs.count_elements(false); i++ { folded_end = folded_end.next } if folded_end != nil { @@ -156,15 +156,28 @@ func i_delete_dir(data *HardData) { 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 - data.ldirs.del(dir) + count := data.litems.curr.Dirs.count_elements(false) + 1 + 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 tmp == nil { + tmp = data.litems.head + } + data.litems.curr = tmp + if data.litems.last != nil { + data.ui.sel_max = data.litems.last.ID + } else { + data.ui.sel_max = 0 + } // TODO: delete folds map reference if folded - // TODO: finish this - // TODO: litems ldirs and shit and lots of segv // TEST: single empty dir // TEST: single non-empty dir // TEST: first dir @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_ui.go - * Wed Jan 10 12:04:11 2024 + * Thu Jan 11 12:22:06 2024 * Joe * * interfacing with the user @@ -228,23 +228,23 @@ func i_draw_delete_box(ui HardUI, item *ItemsNode) { } func i_host_panel_dirs(ui HardUI, icons bool, - dirs *DirsNode, curr *DirsNode, line int) { + dir *DirsNode, curr *DirsNode, line int) { style := ui.dir_style - if dirs == curr { + if dir == curr { style = style.Reverse(true) } text := "" - for i := 0; i < int(dirs.Depth) - 2; i++ { + for i := 0; i < int(dir.Depth) - 2; i++ { text += " " } if icons == true { var fold_var uint8 - if dirs.Folded == true { + if dir.Folded == true { fold_var = 1 } text += DIRS_ICONS[fold_var] } - text += dirs.Name + text += dir.Name spaces := "" for i := 0; i < (ui.dim[W] / 3) - len(text) + 1; i++ { spaces += " " @@ -253,6 +253,9 @@ func i_host_panel_dirs(ui HardUI, icons bool, i_draw_text(ui.s, 1, line, ui.dim[W] / 3, line, style, text) + i_draw_text(ui.s, + ui.dim[W] / 3 - 2, line, ui.dim[W] / 3, line, + ui.def_style, strconv.Itoa(dir.count_elements(true))) } func i_host_panel_host(ui HardUI, icons bool, |