diff options
Diffstat (limited to 'src/e_keys.go')
-rw-r--r-- | src/e_keys.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/e_keys.go b/src/e_keys.go index 620a413..f871038 100644 --- a/src/e_keys.go +++ b/src/e_keys.go @@ -176,6 +176,15 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.insert_sel = 0 ui.insert_sel_ok = false ui.insert_scroll = 0 + tmp := ItemsNode{} + tmp_host := HostNode{} + tmp.Host = &tmp_host + if data.litems.curr.is_dir() == true { + tmp_host.parent = data.litems.curr.Dirs + } else { + tmp_host.parent = data.litems.curr.Host.parent + } + data.litems.add_after(&tmp) } else if event.Rune() == 'e' && data.litems.curr != nil && data.litems.curr.is_dir() == false { @@ -353,6 +362,12 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.insert_sel = 0 data.insert = nil ui.buff.empty() + tmp := data.litems.curr.prev + data.litems.del(data.litems.curr) + if tmp == nil { + tmp = data.litems.head + } + data.litems.curr = tmp } else if event.Key() == tcell.KeyEnter { if ui.buff.len() == 0 { ui.s.HideCursor() @@ -361,6 +376,12 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.insert_sel_ok = false data.insert = nil ui.buff.empty() + tmp := data.litems.curr.prev + data.litems.del(data.litems.curr) + if tmp == nil { + tmp = data.litems.head + } + data.litems.curr = tmp return true } ui.s.HideCursor() @@ -375,6 +396,7 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { } } else { e_readline(event, &ui.buff, ui, data.home_dir) + data.litems.curr.Host.Name = ui.buff.str() } } else if data.insert != nil { if data.insert_err != nil { |