aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_init.go2
-rw-r--r--c_litems.go10
-rw-r--r--i_events.go30
-rw-r--r--i_ui.go2
4 files changed, 28 insertions, 16 deletions
diff --git a/c_init.go b/c_init.go
index 730da45..961a1fb 100644
--- a/c_init.go
+++ b/c_init.go
@@ -123,6 +123,6 @@ func c_load_litems(ldirs *DirsList) *ItemsList {
litems.head.prev = nil
}
litems.curr = litems.head
- litems.draw_start = litems.head
+ litems.draw = litems.head
return &litems
}
diff --git a/c_litems.go b/c_litems.go
index 48e9246..b7b1b4b 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -63,7 +63,7 @@ type ItemsList struct {
head *ItemsNode
last *ItemsNode
curr *ItemsNode
- draw_start *ItemsNode
+ draw *ItemsNode
}
// adds an item node to the list
@@ -88,11 +88,11 @@ func (litems *ItemsList) del(item *ItemsNode) {
if litems.head == item {
litems.head = litems.head.next
if litems.head == nil {
- litems.last, litems.curr, litems.draw_start = nil, nil, nil
+ litems.last, litems.curr, litems.draw = nil, nil, nil
return
}
litems.head.prev = nil
- litems.curr, litems.draw_start = litems.head, litems.head
+ litems.curr, litems.draw = litems.head, litems.head
for ptr := litems.head; ptr != nil; ptr = ptr.next {
ptr.ID -= 1
}
@@ -102,8 +102,8 @@ func (litems *ItemsList) del(item *ItemsNode) {
litems.last = litems.last.prev
litems.last.next = nil
litems.curr = litems.last
- if litems.draw_start == item {
- litems.draw_start = litems.last
+ if litems.draw == item {
+ litems.draw = litems.last
}
return
}
diff --git a/i_events.go b/i_events.go
index e56cec4..23d2db3 100644
--- a/i_events.go
+++ b/i_events.go
@@ -60,17 +60,17 @@ import (
)
func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
- if litems.draw_start == nil || litems.curr == nil {
+ if litems.draw == nil || litems.curr == nil {
return
}
virt_id := litems.curr.ID - (ui.dim[H] - 4) + 4
- for litems.draw_start.ID < virt_id &&
- litems.draw_start.next != nil {
- litems.draw_start = litems.draw_start.next
+ for litems.draw.ID < virt_id &&
+ litems.draw.next != nil {
+ litems.draw = litems.draw.next
}
- for litems.draw_start.ID > litems.curr.ID - 4 &&
- litems.draw_start.prev != nil {
- litems.draw_start = litems.draw_start.prev
+ for litems.draw.ID > litems.curr.ID - 4 &&
+ litems.draw.prev != nil {
+ litems.draw = litems.draw.prev
}
}
@@ -184,7 +184,15 @@ func i_delete_dir(data *HardData) {
i_fold_dir(data, curr)
}
delete(data.folds, curr.Dirs)
- curr.prev.next = curr.next
+ if curr == data.litems.head {
+ data.litems.head = curr.next
+ curr.next.prev = nil
+ if data.litems.draw == curr {
+ data.litems.draw = curr.next
+ }
+ } else {
+ curr.prev.next = curr.next
+ }
if curr.next != nil {
curr.next.prev = curr.prev
data.litems.curr = curr.next
@@ -272,6 +280,10 @@ func i_events(data *HardData) {
} else if event.Key() == tcell.KeyCtrlU ||
event.Key() == tcell.KeyPgUp {
data.litems.inc(-(ui.dim[H] / 3))
+ } else if event.Key() == tcell.KeyCtrlF {
+ // TODO: maybe keymap these
+ } else if event.Key() == tcell.KeyCtrlB {
+ // TODO: maybe keymap these
} else if event.Rune() == '}' ||
event.Rune() == ']' {
// TODO: next dir
@@ -281,7 +293,7 @@ func i_events(data *HardData) {
} else if event.Rune() == 'g' ||
event.Key() == tcell.KeyHome {
data.litems.curr = data.litems.head
- data.litems.draw_start = data.litems.head
+ data.litems.draw = data.litems.head
} else if event.Rune() == 'G' ||
event.Key() == tcell.KeyEnd {
data.litems.curr = data.litems.last
diff --git a/i_ui.go b/i_ui.go
index 31183fe..608b6a6 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -281,7 +281,7 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList, data *HardData) {
ui.dim[W] / 3, ui.dim[H] - 2,
" Hosts ", false)
line := 1
- ptr := litems.draw_start
+ ptr := litems.draw
for ; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next {
if ptr.is_dir() == false && ptr.Host != nil {
i_host_panel_host(ui,