aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-04-16 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-04-16 20:20:20 +0200
commitf4e8e2f2ce9e6e804ef40754937d63e902b97f7e (patch)
treeeece85718d67c92dabb1042280e9d689e98b75ef
parentfuck (diff)
downloadhardflip-f4e8e2f2ce9e6e804ef40754937d63e902b97f7e.tar.gz
hardflip-f4e8e2f2ce9e6e804ef40754937d63e902b97f7e.tar.bz2
hardflip-f4e8e2f2ce9e6e804ef40754937d63e902b97f7e.tar.xz
hardflip-f4e8e2f2ce9e6e804ef40754937d63e902b97f7e.tar.zst
hardflip-f4e8e2f2ce9e6e804ef40754937d63e902b97f7e.zip
gogo
-rw-r--r--src/i_events.go71
-rw-r--r--src/i_insert.go1
2 files changed, 29 insertions, 43 deletions
diff --git a/src/i_events.go b/src/i_events.go
index 6a47074..de59296 100644
--- a/src/i_events.go
+++ b/src/i_events.go
@@ -52,7 +52,6 @@
package main
import (
- "fmt"
"os"
"strconv"
"strings"
@@ -338,13 +337,8 @@ func i_set_protocol_defaults(data *HardData, in *HostNode) {
in.Width = 1600
in.Height = 1200
in.Dynamic = true
- data.insert.Drive = map[string]string{ // WARN: this is a test
- "qwe": "a",
- "asd": "aaaa",
- "zxc": "aaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- "azxc": "aaaaa",
- }
- i_set_drive_keys(data)
+ data.ui.insert_sel_max = INS_RDP_OK + len(in.Drive)
+ in.drive_keys = nil
case PROTOCOL_CMD:
in.Shell = []string{"/bin/sh", "-c"}
data.ui.insert_sel_max = 2
@@ -554,7 +548,6 @@ func i_events(data *HardData) {
}
ui.s.HideCursor()
data.insert = &HostNode{}
- data.insert.Protocol = 1 // WARN: tests only, remove this
i_set_protocol_defaults(data, data.insert)
data.insert.Name = ui.buff
ui.buff = ""
@@ -610,16 +603,6 @@ func i_events(data *HardData) {
} else if event.Rune() == 'i' ||
event.Rune() == 'a' ||
event.Key() == tcell.KeyEnter {
- if data.ui.insert_sel == INS_RDP_DYNAMIC {
- if data.insert.Dynamic == true {
- data.insert.Dynamic = false
- } else {
- data.insert.Dynamic = true
- }
- ui.buff = ""
- ui.s.HideCursor()
- break
- }
data.ui.insert_sel_ok = true
switch data.ui.insert_sel {
case INS_SSH_HOST,
@@ -649,7 +632,14 @@ func i_events(data *HardData) {
case INS_RDP_DOMAIN: ui.buff = data.insert.Domain
case INS_RDP_FILE: ui.buff = data.insert.RDPFile
case INS_RDP_SCREENSIZE: break
- case INS_RDP_DYNAMIC: break
+ case INS_RDP_DYNAMIC:
+ data.ui.insert_sel_ok = false
+ if data.insert.Dynamic == true {
+ data.insert.Dynamic = false
+ } else {
+ data.insert.Dynamic = true
+ }
+ break
case INS_RDP_QUALITY: break
case INS_RDP_DRIVE + len(data.insert.Drive): break
case INS_SSH_OK,
@@ -670,6 +660,24 @@ func i_events(data *HardData) {
ui.drives_buff = ""
ui.s.HideCursor()
}
+ if len(data.insert.Drive) > 0 &&
+ (data.ui.insert_sel >= INS_RDP_DRIVE &&
+ data.ui.insert_sel < INS_RDP_DRIVE +
+ len(data.insert.Drive)) {
+ if event.Rune() == 'y' ||
+ event.Rune() == 'Y' ||
+ event.Key() == tcell.KeyEnter {
+ delete(data.insert.Drive,
+ data.insert.drive_keys[
+ data.ui.insert_sel - INS_RDP_DRIVE])
+ if len(data.insert.Drive) == 0 {
+ data.insert.Drive = nil
+ }
+ i_set_drive_keys(data)
+ }
+ data.ui.insert_sel_ok = false
+ break
+ }
switch data.ui.insert_sel {
case INS_PROTOCOL:
if event.Rune() < '1' || event.Rune() > '4' {
@@ -753,12 +761,6 @@ func i_events(data *HardData) {
ui.drives_buff = ""
ui.buff = ""
ui.s.HideCursor()
- // FIX: can't add shit anymore
- // FIX: data good tho
- ui.s.Fini()
- fmt.Println(data.insert.Drive)
- fmt.Println(data.insert.drive_keys)
- os.Exit(0)
} else {
i_readline(event, &data.ui.buff)
}
@@ -825,23 +827,6 @@ func i_events(data *HardData) {
i_readline(event, &data.ui.buff)
}
}
- if len(data.insert.Drive) > 0 &&
- (data.ui.insert_sel >= INS_RDP_DRIVE &&
- data.ui.insert_sel < INS_RDP_DRIVE +
- len(data.insert.Drive)) {
- if event.Rune() == 'y' ||
- event.Rune() == 'Y' ||
- event.Key() == tcell.KeyEnter {
- delete(data.insert.Drive,
- data.insert.drive_keys[data.ui.insert_sel -
- INS_RDP_DRIVE])
- if len(data.insert.Drive) == 0 {
- data.insert.Drive = nil
- }
- i_set_drive_keys(data)
- }
- data.ui.insert_sel_ok = false
- }
}
}
case MKDIR_MODE:
diff --git a/src/i_insert.go b/src/i_insert.go
index 5bc959c..e64a623 100644
--- a/src/i_insert.go
+++ b/src/i_insert.go
@@ -503,6 +503,7 @@ func i_draw_insert_rdp(ui HardUI, line int, win Quad, in *HostNode) int {
win.T + line, ui.style[DEF_STYLE], text)
if line += 2; win.T + line >= win.B { return line }
for k, v := range in.drive_keys {
+ red = false
if dir := in.Drive[v]; len(dir) > 0 {
if dir[0] == '~' {
home, _ := os.UserHomeDir()