From 69a9f082280331007955ccc0a41fba34dbeee9c0 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 4 Mar 2024 20:20:20 +0100 Subject: good progress --- src/i_events.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/i_events.go') diff --git a/src/i_events.go b/src/i_events.go index 6582ac6..39db96a 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -570,10 +570,12 @@ func i_events(data *HardData) { } else if event.Key() == tcell.KeyEnter { data.ui.insert_sel_ok = true switch data.ui.insert_sel { - case 1: - ui.buff = data.insert.Host - case 2: - ui.buff = strconv.Itoa(int(data.insert.Port)) + case 1: ui.buff = data.insert.Host + case 2: ui.buff = strconv.Itoa(int(data.insert.Port)) + case 3: ui.buff = data.insert.User + case 4: break + case 5: ui.buff = data.insert.Priv + case 6: ui.buff = data.insert.Jump.Host } } } else { @@ -604,21 +606,18 @@ func i_events(data *HardData) { } case 1, 2, 3, 4, 5, 6: if event.Key() == tcell.KeyEnter { - if data.ui.insert_sel == 1 { - data.insert.Host = ui.buff - } else if data.ui.insert_sel == 2 { + switch data.ui.insert_sel { + case 1: data.insert.Host = ui.buff + case 2: tmp, _ := strconv.Atoi(ui.buff) data.insert.Port = uint16(tmp) - } else if data.ui.insert_sel == 3 { - data.insert.User = ui.buff - } else if data.ui.insert_sel == 4 { + case 3: data.insert.User = ui.buff + case 4: pass, _ := c_encrypt_str(ui.buff, data.opts.GPG) data.insert.Pass = pass - } else if data.ui.insert_sel == 5 { - data.insert.Priv = ui.buff - } else if data.ui.insert_sel == 6 { - data.insert.Jump.Host = ui.buff + case 5: data.insert.Priv = ui.buff + case 6: data.insert.Jump.Host = ui.buff } data.ui.insert_sel_ok = false ui.buff = "" -- cgit v1.2.3