aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-05-10 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-05-10 20:20:20 +0200
commit954dbb54bd41e964bb328cdb381d47ff2d468771 (patch)
tree0aa2a30c1f51ec9c3483c02bb6a1dc77e6b4ae24
parentbetter (diff)
downloadhardflip-954dbb54bd41e964bb328cdb381d47ff2d468771.tar.gz
hardflip-954dbb54bd41e964bb328cdb381d47ff2d468771.tar.bz2
hardflip-954dbb54bd41e964bb328cdb381d47ff2d468771.tar.xz
hardflip-954dbb54bd41e964bb328cdb381d47ff2d468771.tar.zst
hardflip-954dbb54bd41e964bb328cdb381d47ff2d468771.zip
go
-rw-r--r--src/c_defs.go5
-rw-r--r--src/e_keys.go8
-rw-r--r--src/i_help.go14
-rw-r--r--src/i_ui.go3
4 files changed, 24 insertions, 6 deletions
diff --git a/src/c_defs.go b/src/c_defs.go
index a905897..b4ff837 100644
--- a/src/c_defs.go
+++ b/src/c_defs.go
@@ -63,10 +63,13 @@ const (
NORMAL_KEYS_HINTS = `a/i: insert host -
m: mkdir -
[C-r]: reload -
-!?: help`
+?: help`
ERROR_KEYS_HINTS = "[Enter]: ok"
CONFIRM_KEYS_HINTS = `y/n: yes - no`
INSERT_KEYS_HINTS = ``
+ HELP_KEYS_HINTS = `q: close -
+j: down -
+k: up`
)
const (
diff --git a/src/e_keys.go b/src/e_keys.go
index c95dad4..16d6bf6 100644
--- a/src/e_keys.go
+++ b/src/e_keys.go
@@ -248,6 +248,7 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
ui.buff = data.litems.curr.Host.Name
} else if event.Rune() == '?' {
ui.mode = HELP_MODE
+ ui.help_scroll = 0
}
return false
}
@@ -833,5 +834,12 @@ func e_rename_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
}
func e_help_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
+ if event.Key() == tcell.KeyEscape ||
+ event.Key() == tcell.KeyCtrlC ||
+ event.Rune() == 'q' {
+ ui.mode = NORMAL_MODE
+ ui.help_scroll = 0
+ return true
+ }
return false
}
diff --git a/src/i_help.go b/src/i_help.go
index 5c179fe..335d5d2 100644
--- a/src/i_help.go
+++ b/src/i_help.go
@@ -52,17 +52,21 @@
package main
func i_draw_help(ui HardUI) {
- if ui.dim[W] < 8 || ui.dim[H] < 4 {
+ if ui.dim[W] < 12 || ui.dim[H] < 6 {
return
}
win := Quad{
- 4,
- 4,
- ui.dim[W] - 4,
- ui.dim[H] - 4,
+ 6,
+ 3,
+ ui.dim[W] - 6,
+ ui.dim[H] - 3,
}
i_draw_box(ui.s,
win.L, win.T, win.R, win.B,
ui.style[BOX_STYLE], ui.style[HEAD_STYLE],
" Keys ", true)
+ i_help_normal(ui)
+}
+
+func i_help_normal(ui HardUI) {
}
diff --git a/src/i_ui.go b/src/i_ui.go
index 327eb4c..4de176f 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -75,6 +75,7 @@ type HardUI struct {
insert_method int
insert_scroll int
insert_butt bool
+ help_scroll int
}
type Quad struct {
@@ -208,6 +209,8 @@ func i_draw_bottom_text(ui HardUI, opts HardOpts,
} else {
text = INSERT_KEYS_HINTS
}
+ case HELP_MODE:
+ text = HELP_KEYS_HINTS
default:
text = ""
}