diff options
author | Joe <rbo@gmx.us> | 2024-04-10 20:20:20 +0200 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-04-10 20:20:20 +0200 |
commit | 2b184f39542f0ae754a22c36da1d83fe2e3e1a29 (patch) | |
tree | abf8fbac9146e3ca13959647b5ab99a6acfddc46 | |
parent | cool (diff) | |
download | hardflip-2b184f39542f0ae754a22c36da1d83fe2e3e1a29.tar.gz hardflip-2b184f39542f0ae754a22c36da1d83fe2e3e1a29.tar.bz2 hardflip-2b184f39542f0ae754a22c36da1d83fe2e3e1a29.tar.xz hardflip-2b184f39542f0ae754a22c36da1d83fe2e3e1a29.tar.zst hardflip-2b184f39542f0ae754a22c36da1d83fe2e3e1a29.zip |
fixin segv
Diffstat (limited to '')
-rw-r--r-- | src/c_litems.go | 2 | ||||
-rw-r--r-- | src/i_host.go | 18 | ||||
-rw-r--r-- | src/i_insert.go | 20 | ||||
-rw-r--r-- | src/i_ui.go | 4 |
4 files changed, 30 insertions, 14 deletions
diff --git a/src/c_litems.go b/src/c_litems.go index b71a008..3f5a654 100644 --- a/src/c_litems.go +++ b/src/c_litems.go @@ -71,6 +71,8 @@ func (litems *ItemsList) add_back(node *ItemsNode) { if litems.head == nil { litems.head = node litems.last = litems.head + litems.curr = litems.head + litems.draw = litems.head return } last := litems.last diff --git a/src/i_host.go b/src/i_host.go index 903f556..829a1d9 100644 --- a/src/i_host.go +++ b/src/i_host.go @@ -111,13 +111,13 @@ func i_draw_host_panel(ui HardUI, icons bool, return } for ptr := litems.draw; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next { - if ptr.is_dir() == false && ptr.Host != nil { + if ptr.is_dir() == false && ptr.Host != nil { i_host_panel_host(ui, - icons, - ptr.Host.parent.Depth, - ptr.Host, - litems.curr.Host, - line) + icons, + ptr.Host.parent.Depth, + ptr.Host, + litems.curr.Host, + line) line++ } else if ptr.Dirs != nil { var dir_icon uint8 @@ -125,9 +125,9 @@ func i_draw_host_panel(ui HardUI, icons bool, dir_icon = 1 } i_host_panel_dirs(ui, icons, dir_icon, - ptr.Dirs, - litems.curr.Dirs, - line) + ptr.Dirs, + litems.curr.Dirs, + line) line++ } } diff --git a/src/i_insert.go b/src/i_insert.go index d9a3e40..f87510d 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -110,17 +110,29 @@ func i_insert_host(data *HardData, insert *HostNode) { // data.litems.curr.Host.next = insert // data.litems.curr.Host.next.next = tmp_next // } + var next *ItemsNode = nil + if data.litems.curr != nil { + next = data.litems.curr.next + } item := &ItemsNode{ 0, nil, insert, data.litems.curr, - data.litems.curr.next, + next, + } + curr := data.litems.curr + if curr != nil { + curr.next = item + if curr.next.next != nil { + data.litems.curr.next.next.prev = item + } + data.litems.curr = data.litems.curr.next + } else { + data.litems.add_back(item) + data.litems.curr = data.litems.head } - data.litems.curr.next = item - data.litems.curr.next.next.prev = item data.litems.reset_id() - data.litems.curr = data.litems.curr.next data.ui.mode = NORMAL_MODE data.insert = nil } diff --git a/src/i_ui.go b/src/i_ui.go index ea76488..cbe2f58 100644 --- a/src/i_ui.go +++ b/src/i_ui.go @@ -408,7 +408,9 @@ func i_prompt_generic(ui HardUI, prompt string, secret bool, home_dir string) { func i_prompt_insert(ui HardUI, curr *ItemsNode) { path := "/" - path = curr.path() + if curr != nil { + path = curr.path() + } path = path[1:] prompt := "Name: " i_draw_text(ui.s, |