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
commit6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8 (patch)
tree81e45eb08f7b8368d76f289b90654f65921558b0
parenthey (diff)
downloadhardflip-6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8.tar.gz
hardflip-6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8.tar.bz2
hardflip-6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8.tar.xz
hardflip-6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8.tar.zst
hardflip-6c5d7510a9e874d29a7576fd5b9fafdd6fd15ab8.zip
dirt but eh fuck it works
Diffstat (limited to '')
-rw-r--r--src/e_keys.go9
-rw-r--r--src/i_insert.go17
-rw-r--r--src/i_ui.go2
3 files changed, 14 insertions, 14 deletions
diff --git a/src/e_keys.go b/src/e_keys.go
index e1ea768..d513a4e 100644
--- a/src/e_keys.go
+++ b/src/e_keys.go
@@ -397,8 +397,9 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
ui.insert_sel += 1
}
if ui.insert_sel < ui.insert_sel_max &&
- ui.insert_line + 2 >= ui.insert_win.B - ui.insert_win.T {
- ui.insert_scroll += 1
+ ui.insert_sel % 2 == 0 &&
+ ui.insert_butt == false {
+ ui.insert_scroll += 2
// TODO: gogo
}
} else if event.Rune() == 'k' ||
@@ -424,8 +425,8 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
} else if ui.insert_sel > INS_PROTOCOL {
ui.insert_sel -= 1
}
- if ui.insert_sel > INS_PROTOCOL {
- ui.insert_scroll -= 1
+ if ui.insert_scroll > 0 && ui.insert_sel % 2 == 0 {
+ ui.insert_scroll -= 2
if ui.insert_scroll < 0 {
ui.insert_scroll = 0
}
diff --git a/src/i_insert.go b/src/i_insert.go
index f0da887..fe24bce 100644
--- a/src/i_insert.go
+++ b/src/i_insert.go
@@ -286,7 +286,6 @@ func i_draw_tick_box(ui *HardUI, line int, dim Quad, label string, content bool,
if id == selected {
tbox_style = tbox_style.Reverse(true).Dim(false)
- ui.insert_line = line
}
l := ui.dim[W] / 2 - len(label) - 2
if l <= dim.L { l = dim.L + 1 }
@@ -312,7 +311,6 @@ func i_draw_text_box(ui *HardUI, line int, dim Quad, label, content string,
if id == selected {
tbox_style = tbox_style.Reverse(true).Dim(false)
- ui.insert_line = line
}
l := ui.dim[W] / 2 - len(label) - 2
@@ -347,7 +345,6 @@ func i_draw_ok_butt(ui *HardUI, dim Quad, line, id, selected int) {
if id == selected {
style = style.Reverse(true).Dim(false)
- ui.insert_line = line
}
buff := "["
for i := 0; i < butt_size / 2 - len(txt); i++ {
@@ -489,6 +486,7 @@ func i_draw_insert_panel(ui *HardUI, in *HostNode, home_dir string) {
i_draw_insert_cmd,
i_draw_insert_os,
}
+ ui.insert_butt = false
end_line = fp[in.Protocol](ui, line, in, home_dir)
if ui.insert_win.T + end_line >= ui.insert_win.B {
ui.s.SetContent(ui.dim[W] / 2, ui.insert_win.B, '▼',
@@ -590,11 +588,11 @@ func i_draw_insert_ssh(ui *HardUI, line int, in *HostNode, home string) int {
INS_SSH_NOTE, false, false)
if line += 2; win.T + line >= win.B { return line }
i_draw_ok_butt(ui, win, win.T + line, INS_SSH_OK, ui.insert_sel)
+ ui.insert_butt = true
return line
}
-func i_draw_insert_rdp(ui *HardUI, line int,
- in *HostNode, home string) int {
+func i_draw_insert_rdp(ui *HardUI, line int, in *HostNode, home string) int {
win := ui.insert_win
red := false
if win.T + line >= win.B { return line }
@@ -738,11 +736,11 @@ func i_draw_insert_rdp(ui *HardUI, line int,
if line += 2; win.T + line >= win.B { return line }
i_draw_ok_butt(ui, win, win.T + line,
INS_RDP_OK + len(in.Drive), ui.insert_sel)
+ ui.insert_butt = true
return line
}
-func i_draw_insert_cmd(ui *HardUI, line int,
- in *HostNode, home string) int {
+func i_draw_insert_cmd(ui *HardUI, line int, in *HostNode, home string) int {
win := ui.insert_win
red := false
if win.T + line >= win.B { return line }
@@ -783,11 +781,11 @@ func i_draw_insert_cmd(ui *HardUI, line int,
INS_CMD_NOTE, false, false)
if line += 2; win.T + line >= win.B { return line }
i_draw_ok_butt(ui, win, win.T + line, INS_CMD_OK, ui.insert_sel)
+ ui.insert_butt = true
return line
}
-func i_draw_insert_os(ui *HardUI, line int,
- in *HostNode, home string) int {
+func i_draw_insert_os(ui *HardUI, line int, in *HostNode, home string) int {
win := ui.insert_win
if win.T + line >= win.B { return line }
text := "---- Host settings ----"
@@ -848,5 +846,6 @@ func i_draw_insert_os(ui *HardUI, line int,
INS_OS_NOTE, false, false)
if line += 2; win.T + line >= win.B { return line }
i_draw_ok_butt(ui, win, win.T + line, INS_OS_OK, ui.insert_sel)
+ ui.insert_butt = true
return line
}
diff --git a/src/i_ui.go b/src/i_ui.go
index d0b1a4b..0015625 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -74,7 +74,7 @@ type HardUI struct {
insert_sel_ok bool
insert_method int
insert_scroll int
- insert_line int
+ insert_butt bool
insert_win Quad
}