From c57bd4c629eca16d665b116a8b296fc595413c43 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 9 Feb 2024 20:20:20 +0100 Subject: fine actually --- src/i_ui.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/i_ui.go') diff --git a/src/i_ui.go b/src/i_ui.go index eefb79f..312f8b5 100644 --- a/src/i_ui.go +++ b/src/i_ui.go @@ -66,6 +66,7 @@ type HardUI struct { style [7]tcell.Style dim [2]int err [2]string + buff string } func i_left_right(text_len int, ui *HardUI) (int, int) { @@ -177,6 +178,9 @@ func i_draw_bottom_text(ui HardUI) { text = "Loading..." case ERROR_MODE: text = ERROR_KEYS_HINTS + case WELCOME_MODE: + default: + text = "" } i_draw_text(ui.s, 1, ui.dim[H] - 1, ui.dim[W] - 1, ui.dim[H] - 1, @@ -268,6 +272,16 @@ func i_draw_welcome_box(ui HardUI) { i_draw_text(ui.s, l, line, r, line, ui.style[STYLE_DEF], text) } +func i_prompt_gpg(ui HardUI) { + text := "gpg: " + i_draw_text(ui.s, + 1, ui.dim[H] - 1, ui.dim[W] - 1, ui.dim[H] - 1, + ui.style[STYLE_DEF], text) + ui.s.ShowCursor(6 + len(ui.buff), ui.dim[H] - 1) + i_draw_text(ui.s, 6, ui.dim[H] - 1, ui.dim[W], ui.dim[H] - 1, + ui.style[STYLE_DEF], ui.buff) +} + func i_draw_zhosts_box(ui HardUI) { i_draw_msg(ui.s, 1, ui.style[STYLE_BOX], ui.dim, " No hosts ") text := "Hosts list empty. Add hosts/folders by pressing (a/m)" @@ -469,6 +483,9 @@ func i_ui(data_dir string) { data_dir, load_err, } + if data.opts.GPG == DEFAULT_OPTS.GPG && data.litems.head == nil { + data.ui.mode = WELCOME_MODE + } for { data.ui.s.Clear() i_draw_bottom_text(data.ui) @@ -478,8 +495,12 @@ func i_ui(data_dir string) { if data.load_err != nil && len(data.load_err) > 0 { data.ui.mode = ERROR_MODE } - if data.opts.GPG == DEFAULT_OPTS.GPG && data.litems.head == nil { + if data.ui.mode == WELCOME_MODE { i_draw_welcome_box(data.ui) + if len(data.opts.GPG) == 0 { + i_prompt_gpg(data.ui) + } else { + } } else if data.litems.head == nil { i_draw_zhosts_box(data.ui) } -- cgit v1.2.3