From 70c7c5d6e110d42dd2d8404268d283baf78626fb Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 10 May 2024 20:20:20 +0200 Subject: go --- ROADMAP.md | 2 +- src/c_defs.go | 2 +- src/e_keys.go | 1 + src/i_help.go | 14 ++++++++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index e7a47e1..6a2ccac 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -46,8 +46,8 @@ ## v0.8 -- [ ] theming - [ ] default ssh key +- [ ] theming ## v1.0 - wheelbite diff --git a/src/c_defs.go b/src/c_defs.go index 928e4a3..5d741ae 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -179,7 +179,7 @@ const ( ) var ( - HELP_KEYS = [][2]string{ + HELP_NORMAL_KEYS = [][2]string{ {"j | ", "Down"}, {"k | ", "Up"}, {"a | i", "Insert host"}, diff --git a/src/e_keys.go b/src/e_keys.go index 079dc88..9f82ccc 100644 --- a/src/e_keys.go +++ b/src/e_keys.go @@ -842,6 +842,7 @@ func e_help_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { return true } else if event.Rune() == 'j' || event.Key() == tcell.KeyDown { + ui.help_scroll += 1 } else if event.Rune() == 'k' || event.Key() == tcell.KeyUp { if ui.help_scroll >= 0 { diff --git a/src/i_help.go b/src/i_help.go index 335d5d2..bafe1e2 100644 --- a/src/i_help.go +++ b/src/i_help.go @@ -51,6 +51,8 @@ package main +import "github.com/gdamore/tcell/v2" + func i_draw_help(ui HardUI) { if ui.dim[W] < 12 || ui.dim[H] < 6 { return @@ -65,8 +67,16 @@ func i_draw_help(ui HardUI) { win.L, win.T, win.R, win.B, ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " Keys ", true) - i_help_normal(ui) + line := 0 + i_help_normal(ui, win, &line) } -func i_help_normal(ui HardUI) { +func i_help_normal(ui HardUI, win Quad, line *int) { + for _, v := range HELP_NORMAL_KEYS { + i_draw_text(ui.s, win.L + 4, win.T + 1 + *line, win.R - 1, win.T + 1 + *line, + ui.style[DEF_STYLE], v[0]) + i_draw_text(ui.s, win.L + 10, win.T + 1 + *line, win.R - 1, win.T + 1 + *line, + ui.style[DEF_STYLE], v[1]) + *line += 1 + } } -- cgit v1.2.3