summaryrefslogtreecommitdiff
path: root/toolkit/gocui/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-12-16 06:57:39 -0600
committerJeff Carr <[email protected]>2023-12-16 06:57:39 -0600
commit87ab9a958d9eb9f4db35d5c9f9ce923df3132dad (patch)
treefd3ee29d828e9e69175a6ca04fec6ae0fe60fcc0 /toolkit/gocui/main.go
parentdcce32583387be7fc4f6cd8c8dea62fd7dc42ecf (diff)
gocui: fixes to labels + line entriesv0.8.8.1v0.8.8
correct line hight dump non-working size rectangle code somehow works better better dropdown menu debugging minor fixes to common.go more common code Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/main.go')
-rw-r--r--toolkit/gocui/main.go28
1 files changed, 13 insertions, 15 deletions
diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go
index 6214fcb..04e1255 100644
--- a/toolkit/gocui/main.go
+++ b/toolkit/gocui/main.go
@@ -17,7 +17,7 @@ func init() {
// init the config struct default values
Set(&me, "default")
- me.pluginChan = make(chan toolkit.Action)
+ pluginChan = make(chan toolkit.Action)
log(logNow, "Init() start pluginChan")
go catchActionChannel()
@@ -26,15 +26,6 @@ func init() {
sleep(.1) // probably not needed, but in here for now under development
}
-// this sets the channel to send user events back from the plugin
-func Callback(guiCallback chan toolkit.Action) {
- me.callback = guiCallback
-}
-
-func PluginChannel() chan toolkit.Action {
- return me.pluginChan
-}
-
/*
recieves requests from the program to do things like:
* add new widgets
@@ -46,7 +37,7 @@ func catchActionChannel() {
for {
log(logInfo, "catchActionChannel() infinite for() loop restarted select on channel")
select {
- case a := <-me.pluginChan:
+ case a := <-pluginChan:
if (me.baseGui == nil) {
// something went wrong initializing the gocui
log(logError,"ERROR: console did not initialize")
@@ -60,22 +51,29 @@ func catchActionChannel() {
func Exit() {
// TODO: what should actually happen here?
+ log(true, "Exit() here. doing standardExit()")
standardExit()
}
func standardExit() {
+ log(true, "standardExit() doing baseGui.Close()")
me.baseGui.Close()
+ log(true, "standardExit() doing outf.Close()")
outf.Close()
- setOutput(os.Stdout)
- sendBackQuit()
- sleep(.5)
+ // log(true, "standardExit() setOutput(os.Stdout)")
+ // setOutput(os.Stdout)
+ log(true, "standardExit() send back Quit()")
+ go sendBackQuit() // don't stall here in case the
+ // induces a delay in case the callback channel is broken
+ sleep(1)
+ log(true, "standardExit() exit()")
exit()
}
func sendBackQuit() {
// send 'Quit' back to the program (?)
var a toolkit.Action
a.ActionType = toolkit.UserQuit
- me.callback <- a
+ callback <- a
}
var outf *os.File