aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-09 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-09 20:20:20 +0100
commitfef0eba4ab59102d92a4b03acf482ed98bd9828b (patch)
tree96a5f9f4693593da8ade8e42189fe055bd8ce798 /i_events.go
parenti can't fix that shit (diff)
downloadhardflip-fef0eba4ab59102d92a4b03acf482ed98bd9828b.tar.gz
hardflip-fef0eba4ab59102d92a4b03acf482ed98bd9828b.tar.bz2
hardflip-fef0eba4ab59102d92a4b03acf482ed98bd9828b.tar.xz
hardflip-fef0eba4ab59102d92a4b03acf482ed98bd9828b.tar.zst
hardflip-fef0eba4ab59102d92a4b03acf482ed98bd9828b.zip
small fix
Diffstat (limited to '')
-rw-r--r--i_events.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/i_events.go b/i_events.go
index 62c93d7..b0e904e 100644
--- a/i_events.go
+++ b/i_events.go
@@ -72,7 +72,7 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
if litems.draw_start == nil || litems.curr == nil {
return
}
- virt_id := litems.curr.ID - (ui.dim[H] - 4) - ui.folded_count
+ virt_id := litems.curr.ID - (ui.dim[H] - 4) // - ui.folded_count
for litems.draw_start.ID < virt_id &&
litems.draw_start.next != nil {
litems.draw_start = litems.draw_start.next
@@ -83,17 +83,18 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
litems.draw_start = litems.draw_start.prev
}
// fmt.Println(">>>>> DRAW_START:", litems.draw_start.ID, "<<<<<<< >>>>>>>> VIRT_ID:", virt_id)
- if litems.draw_start.prev != nil &&
- litems.draw_start.prev.is_dir() == true &&
- litems.draw_start.prev.Dirs.Folded == true {
- tmp := litems.draw_start.prev.Dirs.count_elements()
- for i := 0; i < tmp && litems.draw_start != nil; i++ {
- litems.draw_start = litems.draw_start.next
- }
- }
+ // if litems.draw_start.prev != nil &&
+ // litems.draw_start.prev.is_dir() == true &&
+ // litems.draw_start.prev.Dirs.Folded == true {
+ // tmp := litems.draw_start.prev.Dirs.count_elements()
+ // for i := 0; i < tmp && litems.draw_start != nil; i++ {
+ // litems.draw_start = litems.draw_start.next
+ // }
+ // }
}
func i_reload_data(data *HardData) {
+ // FIX: segv if data dir is removed
data.ldirs = c_load_data_dir(data.data_dir, data.opts)
data.litems = c_load_litems(data.ldirs)
data.ui.sel_max = data.litems.last.ID
@@ -162,6 +163,10 @@ func i_events(data *HardData) {
data.litems.draw_start = data.litems.head
} else if event.Rune() == 'G' {
data.litems.curr = data.litems.last
+ for data.litems.curr.prev != nil &&
+ data.litems.curr.folded_parents() == true {
+ data.litems.curr = data.litems.curr.prev
+ }
} else if event.Rune() == 'D' &&
data.ldirs.head != nil &&
ui.sel_max != 0 {