aboutsummaryrefslogtreecommitdiffstats
path: root/src/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-04-15 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-04-15 20:20:20 +0200
commitb33dca29fdf3ccefd16412589feefd66b735a534 (patch)
tree35f58b8e433e77ec1ab2dcf7381f80c8f9dcfbf9 /src/i_events.go
parentprogress (diff)
downloadhardflip-b33dca29fdf3ccefd16412589feefd66b735a534.tar.gz
hardflip-b33dca29fdf3ccefd16412589feefd66b735a534.tar.bz2
hardflip-b33dca29fdf3ccefd16412589feefd66b735a534.tar.xz
hardflip-b33dca29fdf3ccefd16412589feefd66b735a534.tar.zst
hardflip-b33dca29fdf3ccefd16412589feefd66b735a534.zip
up
Diffstat (limited to '')
-rw-r--r--src/i_events.go103
1 files changed, 58 insertions, 45 deletions
diff --git a/src/i_events.go b/src/i_events.go
index 9d40333..32fa38d 100644
--- a/src/i_events.go
+++ b/src/i_events.go
@@ -52,6 +52,7 @@
package main
import (
+ "fmt"
"os"
"strconv"
"strings"
@@ -619,13 +620,6 @@ func i_events(data *HardData) {
break
}
data.ui.insert_sel_ok = true
- if len(data.insert.Drive) > 0 &&
- data.ui.insert_sel >= INS_RDP_DRIVE &&
- data.ui.insert_sel < INS_RDP_DRIVE +
- len(data.insert.Drive) {
- // TODO: here
- data.ui.insert_sel_ok = false
- }
switch data.ui.insert_sel {
case INS_SSH_HOST,
INS_RDP_HOST:
@@ -725,6 +719,48 @@ func i_events(data *HardData) {
data.ui.insert_sel_ok = false
ui.s.HideCursor()
}
+ case INS_RDP_DRIVE + len(data.insert.Drive):
+ if len(data.ui.drives_buff) == 0 {
+ if event.Key() == tcell.KeyEnter {
+ if len(ui.buff) == 0 {
+ data.ui.insert_sel_ok = false
+ data.ui.drives_buff = ""
+ ui.buff = ""
+ ui.s.HideCursor()
+ break
+ }
+ data.ui.drives_buff = ui.buff
+ ui.buff = ""
+ } else {
+ i_readline(event, &data.ui.buff)
+ }
+ } else {
+ if event.Key() == tcell.KeyEnter {
+ if len(ui.buff) == 0 {
+ data.ui.insert_sel_ok = false
+ data.ui.drives_buff = ""
+ ui.buff = ""
+ ui.s.HideCursor()
+ break
+ }
+ data.ui.insert_sel_ok = false
+ if len(data.insert.Drive) == 0 {
+ data.insert.Drive = make(map[string]string)
+ }
+ data.insert.Drive[ui.drives_buff] = ui.buff
+ ui.s.Fini()
+ fmt.Println(data.insert.Drive)
+ os.Exit(0)
+ i_set_drive_keys(data)
+ data.ui.insert_sel_max = INS_RDP_OK +
+ len(data.insert.Drive)
+ ui.drives_buff = ""
+ ui.buff = ""
+ ui.s.HideCursor()
+ } else {
+ i_readline(event, &data.ui.buff)
+ }
+ }
case INS_SSH_HOST,
INS_SSH_PORT,
INS_SSH_USER,
@@ -786,45 +822,22 @@ func i_events(data *HardData) {
} else {
i_readline(event, &data.ui.buff)
}
- case INS_RDP_DRIVE + len(data.insert.Drive):
- if len(data.ui.drives_buff) == 0 {
- if event.Key() == tcell.KeyEnter {
- if len(ui.buff) == 0 {
- data.ui.insert_sel_ok = false
- data.ui.drives_buff = ""
- ui.buff = ""
- ui.s.HideCursor()
- break
- }
- data.ui.drives_buff = ui.buff
- ui.buff = ""
- } else {
- i_readline(event, &data.ui.buff)
- }
- } else {
- if event.Key() == tcell.KeyEnter {
- if len(ui.buff) == 0 {
- data.ui.insert_sel_ok = false
- data.ui.drives_buff = ""
- ui.buff = ""
- ui.s.HideCursor()
- break
- }
- data.ui.insert_sel_ok = false
- if len(data.insert.Drive) == 0 {
- data.insert.Drive = make(map[string]string)
- }
- data.insert.Drive[ui.drives_buff] = ui.buff
- i_set_drive_keys(data)
- data.ui.insert_sel_max = INS_RDP_OK +
- len(data.insert.Drive)
- ui.drives_buff = ""
- ui.buff = ""
- ui.s.HideCursor()
- } else {
- 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])
+ data.ui.insert_sel_max = INS_RDP_OK +
+ len(data.insert.Drive)
+ i_set_drive_keys(data)
}
+ data.ui.insert_sel_ok = false
}
}
}