aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-08 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-08 20:20:20 +0100
commit18261f3f21383d74e332d445ebb0de7b30de64d8 (patch)
tree03052dc53de5e62a5797cc407a2050004e4978cd
parentgreat (diff)
downloadhardflip-18261f3f21383d74e332d445ebb0de7b30de64d8.tar.gz
hardflip-18261f3f21383d74e332d445ebb0de7b30de64d8.tar.bz2
hardflip-18261f3f21383d74e332d445ebb0de7b30de64d8.tar.xz
hardflip-18261f3f21383d74e332d445ebb0de7b30de64d8.tar.zst
hardflip-18261f3f21383d74e332d445ebb0de7b30de64d8.zip
movement
-rw-r--r--c_init.go16
-rw-r--r--c_litems.go2
-rw-r--r--i_events.go12
-rw-r--r--i_ui.go8
4 files changed, 16 insertions, 22 deletions
diff --git a/c_init.go b/c_init.go
index dada0c8..db6001f 100644
--- a/c_init.go
+++ b/c_init.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_init.go
- * Fri Jan 05 16:53:38 2024
+ * Mon Jan 08 11:53:48 2024
* Joe
*
* init functions
@@ -80,11 +80,7 @@ func c_recurse_data_dir(dir, root string, opts HardOpts,
opts.FoldAll,
nil,
}
- // item_node := ItemsNode{}
- // item_node.Dirs = &dir_node
- // item_node.Host = nil
ldirs.add_back(&dir_node)
- // litems.add_back(&item_node)
for _, file := range files {
filename := file.Name()
if file.IsDir() == true {
@@ -95,10 +91,6 @@ func c_recurse_data_dir(dir, root string, opts HardOpts,
if host_node == nil {
return
}
- // item_node := ItemsNode{}
- // item_node.Dirs = nil
- // item_node.Host = host_node
- // litems.add_back(&item_node)
host_node.Filename = filename
host_node.Parent = &dir_node
dir_node.lhost.add_back(host_node)
@@ -131,6 +123,10 @@ func c_load_litems(ldirs *DirsList) *ItemsList {
litems.add_back(&item)
}
}
- litems.curr = litems.head.next
+ litems.head = litems.head.next
+ if litems.head != nil {
+ litems.head.prev = nil
+ }
+ litems.curr = litems.head
return &litems
}
diff --git a/c_litems.go b/c_litems.go
index 63338bd..24a7844 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_litems.go
- * Fri Jan 05 15:04:07 2024
+ * Mon Jan 08 11:53:22 2024
* Joe
*
* the dir and hosts linked list
diff --git a/i_events.go b/i_events.go
index b710317..1a8b4ca 100644
--- a/i_events.go
+++ b/i_events.go
@@ -97,16 +97,18 @@ func i_events(data *HardData) {
os.Exit(0)
} else if event.Rune() == 'j' ||
event.Key() == tcell.KeyDown {
- ui.inc_sel(1, data)
+ ui.inc_sel(+1, data)
} else if event.Rune() == 'k' ||
event.Key() == tcell.KeyUp {
ui.inc_sel(-1, data)
+ } else if event.Key() == tcell.KeyCtrlD {
+ ui.inc_sel(ui.dim[H] / 4, data)
+ } else if event.Key() == tcell.KeyCtrlU {
+ ui.inc_sel(-(ui.dim[H] / 4), data)
} else if event.Rune() == 'g' {
- // TODO: litems.curr
- ui.sel_id = 0
+ data.litems.curr = data.litems.head
} else if event.Rune() == 'G' {
- // TODO: litems.curr
- ui.sel_id = ui.sel_max - 1
+ data.litems.curr = data.litems.last
} else if event.Rune() == 'D' &&
data.ldirs.head != nil &&
ui.sel_max != 0 {
diff --git a/i_ui.go b/i_ui.go
index 0e6fd9a..d05a095 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -78,10 +78,6 @@ func (ui *HardUI) inc_sel(n int, data *HardData) {
if data.litems.curr == nil {
return
}
- if ui.sel_id + n < 1 ||
- ui.sel_id + n > ui.sel_max {
- n = 0
- }
data.litems.curr = data.litems.curr.inc(n)
ui.sel_id = data.litems.curr.ID
if ui.sel_id > ui.list_start + ui.dim[H] - 4 {
@@ -298,8 +294,8 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList) {
ui.dim[W] / 3, ui.dim[H] - 2,
" Hosts ", false)
line := 1
- ptr := litems.head.next
- for ptr = ptr; ptr != nil; ptr = ptr.next {
+ ptr := litems.head
+ for ptr = ptr; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next {
if ptr.is_dir() == false {
i_host_panel_host(ui,
icons,