diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c_defs.go | 61 | ||||
-rw-r--r-- | src/c_fuzz.go | 23 | ||||
-rw-r--r-- | src/e_keys.go | 1 | ||||
-rw-r--r-- | src/i_help.go | 4 | ||||
-rw-r--r-- | src/i_host.go | 2 | ||||
-rw-r--r-- | src/i_info.go | 2 | ||||
-rw-r--r-- | src/i_insert.go | 2 |
7 files changed, 42 insertions, 53 deletions
diff --git a/src/c_defs.go b/src/c_defs.go index 480cf66..fc6c4c2 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -185,44 +185,31 @@ const ( INSERT_EDIT ) -var INSERT_HINTS = [INS_MAX]string{ - "Select the protocol used to connect to your host", - "IP or domain name of your host", - "Port used for SSH (default: 22)", - "User used to log in (default: root)", - "Password for your user", - "SSH private key used to log in instead of a password", - "Optional shell command line that will be run on your host", - "IP or domain name of your jump host", - "Port used for your jump SSH host (default: 22)", - // NOTE: fuck this anyway - } - var HELP_NORMAL_KEYS = [][2]string{ - {"<down> | j", "Go to next item"}, - {"<up> | k", "Go to previous item"}, - {"<pgdown> | <c-d>", "Jump down"}, - {"<pgup> | <c-u>", "Jump up"}, - {"} | ]", "Go to next directory"}, - {"{ | [", "Go to previous directory"}, - {"g", "Go to first item"}, - {"G", "Go to last item"}, - {"D", "Delete selected item"}, - {"h", "Close current directory"}, - {"H", "Close all directories"}, - {"l | <space>", "Toggle directory"}, - {"<right> | l | <enter>", "Connect to selected host / toggle directory"}, - {"a | i", "Create a new host"}, - {"y", "Copy selected host"}, - {"d", "Cut selected host"}, - {"p", "Paste host in clipboard"}, - {"<f7> | m", "Create a new directory"}, - {"e", "Edit selected host"}, - {"c | C | A", "Rename selected item"}, - {"<c-r>", "Reload data and configuration"}, - {"/ | <c-f>", "Fuzzy search"}, - {"?", "Display this help menu"}, - {"<c-c> | q", "Quit"}, + {"<down> | j", "go to next item"}, + {"<up> | k", "go to previous item"}, + {"<pgdown> | <c-d>", "jump down"}, + {"<pgup> | <c-u>", "jump up"}, + {"} | ]", "go to next directory"}, + {"{ | [", "go to previous directory"}, + {"g", "go to first item"}, + {"G", "go to last item"}, + {"D", "delete selected item"}, + {"h", "close current directory"}, + {"H", "close all directories"}, + {"l | <space>", "toggle directory"}, + {"<right> | l | <enter>", "connect to selected host / toggle directory"}, + {"a | i", "create a new host"}, + {"y", "copy selected host"}, + {"d", "cut selected host"}, + {"p", "paste host in clipboard"}, + {"<f7> | m", "create a new directory"}, + {"e", "edit selected host"}, + {"c | C | A", "rename selected item"}, + {"<c-r>", "reload data and configuration"}, + {"/ | f | <c-f>", "fuzzy search"}, + {"?", "display this help menu"}, + {"<c-c> | q", "quit"}, } var ( diff --git a/src/c_fuzz.go b/src/c_fuzz.go index 68976bd..fa07dc4 100644 --- a/src/c_fuzz.go +++ b/src/c_fuzz.go @@ -91,24 +91,24 @@ func c_fuzz_find_item(str_out string, litems *ItemsList) (*ItemsNode) { return nil } -func c_fuzz(data *HardData, ui *HardUI) { - if ui.s != nil { - if err := ui.s.Suspend(); err != nil { - c_error_mode("screen", err, ui) - return - } +func c_fuzz(data *HardData, ui *HardUI) (bool) { + if err := ui.s.Suspend(); err != nil && ui.s != nil { + c_error_mode("screen", err, ui) + return false } search := exec.Command("fzf") stdin, stdout := c_fuzz_init_pipes(ui, search) if stdin == nil || stdout == nil { - return + return false } if err := search.Start(); err != nil { - c_error_mode("fzf", err, ui) - if ui.s != nil { + if ui != nil { + c_error_mode("fzf", err, ui) c_resume_or_die(ui) + return false + } else { + c_die("fzf", err) } - return } go func() { defer stdin.Close() @@ -136,8 +136,9 @@ func c_fuzz(data *HardData, ui *HardUI) { if ui.s != nil { c_error_mode("item not found", nil, ui) } - return + return false } data.litems.curr = item } + return true } diff --git a/src/e_keys.go b/src/e_keys.go index 1e598b5..67cb8ce 100644 --- a/src/e_keys.go +++ b/src/e_keys.go @@ -252,6 +252,7 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.buff.insert(data.litems.curr.Dirs.Name) } } else if (event.Rune() == '/' || + event.Rune() == 'f' || event.Key() == tcell.KeyCtrlF) && data.litems.curr != nil { c_fuzz(data, ui) diff --git a/src/i_help.go b/src/i_help.go index 7f549a0..de0a085 100644 --- a/src/i_help.go +++ b/src/i_help.go @@ -67,7 +67,7 @@ func i_draw_help(ui *HardUI) { i_draw_box(ui.s, win.L, win.T, win.R, win.B, ui.style[BOX_STYLE], ui.style[HEAD_STYLE], - " Keys ", true) + " keys ", true) line := 0 line -= ui.help_scroll if line < 0 { @@ -94,7 +94,7 @@ func i_help_normal(ui HardUI, win Quad, line *int) bool { return false } i := delim - 1 - len(v[0]) - if i < 0 { i = 0 } + i = max(i, 0) i_draw_text(ui.s, win.L + 1 + i, win.T + 1 + *line, win.L + delim, win.T + 1 + *line, ui.style[BOT_STYLE], v[0]) i_draw_text(ui.s, win.L + delim + 1, win.T + 1 + *line, win.R, diff --git a/src/i_host.go b/src/i_host.go index 6c28f51..b06486d 100644 --- a/src/i_host.go +++ b/src/i_host.go @@ -110,7 +110,7 @@ func i_draw_host_panel(ui HardUI, icons bool, litems *ItemsList, data *HardData) { i_draw_box(ui.s, 0, 0, ui.dim[W] / 3, ui.dim[H] - 2, - ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " Hosts ", false) + ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " hosts ", false) line := 1 if litems == nil || litems.head == nil { return diff --git a/src/i_info.go b/src/i_info.go index 4802feb..c27afe6 100644 --- a/src/i_info.go +++ b/src/i_info.go @@ -469,7 +469,7 @@ func i_draw_info_panel(ui HardUI, percent bool, litems *ItemsList) { i_draw_box(ui.s, (ui.dim[W] / 3), 0, ui.dim[W] - 1, ui.dim[H] - 2, - ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " Infos ", false) + ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " infos ", false) ui.s.SetContent(ui.dim[W] / 3, 0, tcell.RuneTTee, nil, ui.style[BOX_STYLE]) ui.s.SetContent(ui.dim[W] / 3, ui.dim[H] - 2, tcell.RuneBTee, nil, ui.style[BOX_STYLE]) diff --git a/src/i_insert.go b/src/i_insert.go index a147cb3..84c6468 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -471,7 +471,7 @@ func i_draw_insert_panel(ui *HardUI, in *HostNode, home_dir string) { i_draw_box(ui.s, win.L, win.T, win.R, win.B, ui.style[BOX_STYLE], ui.style[HEAD_STYLE], - " Insert - " + in.Name + " ", true) + " insert - " + in.Name + " ", true) line := i_insert_follow_cursor(ui.insert_scroll, 2) if line <= 0 { ui.s.SetContent(ui.dim[W] / 2, win.T, '▲', nil, ui.style[BOX_STYLE]) |