From 8fcad97e2eea916323d30be1f60986d83b2fb9c1 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 20 Feb 2024 20:20:20 +0100 Subject: cool --- src/i_events.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/i_events.go') diff --git a/src/i_events.go b/src/i_events.go index 7b4f38c..64260f1 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -340,7 +340,49 @@ func i_events(data *HardData) { data.litems.head != nil && data.litems.curr != nil { ui.mode = DELETE_MODE + } else if event.Rune() == 'H' { + for curr := data.ldirs.head; curr != nil; curr = curr.next { + if data.folds[curr] == nil { + i_fold_dir(data, curr) + } + } + } else if event.Rune() == 'h' || + event.Key() == tcell.KeyLeft { + for curr := data.litems.curr; + curr != nil; + curr = curr.prev { + if curr.is_dir() == true { + if data.folds[curr.Dirs] == nil { + i_fold_dir(data, curr) + data.litems.curr = curr + break + } else { + if data.folds[curr.Dirs.Parent] == nil { + parent := curr.Dirs.Parent + for curr_new := curr; + curr_new != nil; + curr_new = curr_new.prev { + if curr_new.is_dir() == true { + if curr_new.Dirs == parent { + i_fold_dir(data, curr_new) + data.litems.curr = curr_new + break + // TODO: here + } else { + if data.folds[curr_new.Dirs] == + nil { + i_fold_dir(data, curr_new) + } + } + } + } + } + break + } + } + } } else if event.Rune() == 'l' || + event.Key() == tcell.KeyRight || event.Key() == tcell.KeyEnter { if data.litems.curr == nil { break -- cgit v1.2.3