aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c_litems.go21
-rw-r--r--i_events.go8
2 files changed, 26 insertions, 3 deletions
diff --git a/c_litems.go b/c_litems.go
index b7b1b4b..4aa21d6 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -167,6 +167,26 @@ func (litems *ItemsList) inc(jump int) {
litems.curr = new_item
}
+// returns the previous dir
+func (item *ItemsNode) prev_dir() *ItemsNode {
+ for ptr := item.prev; ptr != nil && ptr.prev != nil; ptr = ptr.prev {
+ if ptr.is_dir() == true {
+ return ptr
+ }
+ }
+ return nil
+}
+
+// returns the next dir
+func (item *ItemsNode) next_dir() *ItemsNode {
+ for ptr := item.next; ptr != nil && ptr.next != nil; ptr = ptr.next {
+ if ptr.is_dir() == true {
+ return ptr
+ }
+ }
+ return nil
+}
+
// returns the next directory in line with the same or lower depth
func (item *ItemsNode) get_next_level() *ItemsNode {
if item == nil || item.Dirs == nil {
@@ -190,4 +210,3 @@ func (item *ItemsNode) get_next_level() *ItemsNode {
}
return nil
}
-
diff --git a/i_events.go b/i_events.go
index 7e2197c..acd8e96 100644
--- a/i_events.go
+++ b/i_events.go
@@ -273,10 +273,14 @@ func i_events(data *HardData) {
// TODO: maybe keymap these
} else if event.Rune() == '}' ||
event.Rune() == ']' {
- // TODO: next dir
+ if next := data.litems.curr.next_dir(); next != nil {
+ data.litems.curr = next
+ }
} else if event.Rune() == '{' ||
event.Rune() == '[' {
- // TODO: prev dir
+ if prev := data.litems.curr.prev_dir(); prev != nil {
+ data.litems.curr = prev
+ }
} else if event.Rune() == 'g' ||
event.Key() == tcell.KeyHome {
data.litems.curr = data.litems.head