Compare commits

..

No commits in common. "guimaster" and "v0.22.44" have entirely different histories.

12 changed files with 36 additions and 60 deletions

1
.gitignore vendored
View File

@ -5,4 +5,3 @@
go.mod go.mod
go.sum go.sum
gocui gocui
resources/*.so

View File

@ -25,7 +25,7 @@ custom:
clean: clean:
rm -f gocui *.so go.* rm -f gocui *.so go.*
rm -f *.pb.go *.patch rm -f *.pb.go *.patch
go-mod-clean purge go-mod-clean --purge
# Test the README.md & doc.go file # Test the README.md & doc.go file
# this runs pkgsite, the binary that does dev.go.dev # this runs pkgsite, the binary that does dev.go.dev

View File

@ -58,7 +58,6 @@ func registerHandlers(g *gocui.Gui) {
g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view
g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse
g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons
g.SetKeybinding("", 'r', gocui.ModNone, reverseStdout) // 'r' turns scrolling of STDOUT upside down
g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?) g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?)
} }
@ -104,9 +103,7 @@ func theDarkness(g *gocui.Gui, v *gocui.View) error {
log.Info("you have seen the light") log.Info("you have seen the light")
} else { } else {
me.dark = true me.dark = true
log.Info("you have entered into darkness (you may need to trigger SIGWINCH)") log.Info("you have entered into darkness")
log.Info("or maybe open a new window. notsure. This obviously isn't finished.")
log.Info("submit patches to this and you will definitely get free cloud credits at WIT")
} }
return nil return nil
} }
@ -141,13 +138,11 @@ func doEsc(g *gocui.Gui, v *gocui.View) error {
me.dropdown.tk.Hide() me.dropdown.tk.Hide()
me.dropdown.active = false me.dropdown.active = false
log.Info("escaped from dropdown") log.Info("escaped from dropdown")
me.baseGui.SetCurrentView(me.notify.clock.tk.cuiName)
} }
if me.textbox.active { if me.textbox.active {
me.textbox.tk.Hide() me.textbox.tk.Hide()
me.textbox.active = false me.textbox.active = false
log.Info("escaped from textbox") log.Info("escaped from textbox")
me.baseGui.SetCurrentView(me.notify.clock.tk.cuiName)
} }
return nil return nil
} }
@ -185,19 +180,6 @@ func theFind(g *gocui.Gui, v *gocui.View) error {
return nil return nil
} }
func reverseStdout(g *gocui.Gui, v *gocui.View) error {
if me.stdout.reverse {
me.stdout.reverse = false
log.Info("stdout scrolling normal")
} else {
me.stdout.reverse = true
log.Info("stdout scrolling is reversed. this is sometimes useful when you")
log.Info("only need to see a few most recent lines and have the STDOUT window")
log.Info("take up minimal realestate at the bottom of your window")
}
return nil
}
// is run whenever anyone hits 'd' (in an open space) // is run whenever anyone hits 'd' (in an open space)
func theLetterD(g *gocui.Gui, v *gocui.View) error { func theLetterD(g *gocui.Gui, v *gocui.View) error {
// widgets that don't have physical existance in // widgets that don't have physical existance in

View File

@ -77,20 +77,12 @@ func stdoutHome(g *gocui.Gui, v *gocui.View) error {
} }
func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error { func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error {
if me.stdout.reverse { stdoutWheelsUp()
stdoutWheelsDown()
} else {
stdoutWheelsUp()
}
return nil return nil
} }
func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error { func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
if me.stdout.reverse { stdoutWheelsDown()
stdoutWheelsUp()
} else {
stdoutWheelsDown()
}
return nil return nil
} }

13
find.go
View File

@ -129,6 +129,13 @@ func findWindowUnderMouse() *guiWidget {
} }
} }
/*
// print out the window list
for _, tk := range me.allwin {
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
}
*/
// now check if the active window is below the mouse // now check if the active window is below the mouse
for _, tk := range me.allwin { for _, tk := range me.allwin {
if tk.window.active { if tk.window.active {
@ -145,6 +152,12 @@ func findWindowUnderMouse() *guiWidget {
return a.window.order - b.window.order return a.window.order - b.window.order
}) })
/*
// print out the window list
for _, tk := range me.allwin {
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
}
*/
for _, win := range me.allwin { for _, win := range me.allwin {
if win.full.inRect(w, h) { if win.full.inRect(w, h) {
// log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h)) // log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h))

20
help.go
View File

@ -25,20 +25,16 @@ import (
var helpText []string = []string{"Help Menu", var helpText []string = []string{"Help Menu",
"", "",
"Tab toggle through windows", "Tab: toggle through windows",
"'O' toggle STDOUT", "O: toggle STDOUT",
"'H' toggle this gocui menu", "H: toggle this gocui menu",
"'D' toggle light/dark mode", "L: toggle light/dark mode",
"CTRL-z background to shell", "CTRL-c: quit()",
"CTRL-c quit()",
"", "",
"Debugging:", "Debugging:",
"'S' Supermouse mode", "S: Supermouse mode",
"'M' list all widget positions", "M: list all widget positions",
"'L' list all widgets in tree", "L: list all widgets in tree",
"<Pgup> scroll up the STDOUT window",
"<Pgdn> scroll down the STDOUT window",
"'r' reverse STDOUT scrolling",
} }
func hideHelp() { func hideHelp() {

View File

@ -108,6 +108,7 @@ func toolkitInit() {
if me.textbox.tk == nil { if me.textbox.tk == nil {
log.Log(INFO, "gocui toolkitInit() initTextbox me.ok =", me.ok) log.Log(INFO, "gocui toolkitInit() initTextbox me.ok =", me.ok)
initTextbox() initTextbox()
me.textbox.tk.prepTextbox()
} }
// TEST TEXTBOX END // TEST TEXTBOX END
} }
@ -456,6 +457,7 @@ func newWindowTrigger() {
} }
if me.textbox.tk == nil { if me.textbox.tk == nil {
initTextbox() initTextbox()
me.textbox.tk.prepTextbox()
} }
tk.makeWindowActive() tk.makeWindowActive()
me.myTree.Unlock() me.myTree.Unlock()

View File

@ -150,17 +150,6 @@ func setNotifyIconText(s string) {
me.notify.icon.tk.setColorNotifyIcon() me.notify.icon.tk.setColorNotifyIcon()
me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name()) me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
log.Info("setNotifyIconText() updated menu to:", me.notify.icon.tk.labelN) log.Info("setNotifyIconText() updated menu to:", me.notify.icon.tk.labelN)
// print out the window list // TODO: put this in libnotify
for _, tk := range me.allwin {
log.Info("known window Window", tk.labelN, tk.window.active, tk.window.order)
}
if s == "[X]" {
log.Warn("should turn on help window here")
showHelp()
} else {
log.Warn("should turn off help window here")
hideHelp()
}
} }
// in the very end of redrawing things, this will place the help and stdout on the top or botton // in the very end of redrawing things, this will place the help and stdout on the top or botton

View File

@ -162,10 +162,10 @@ func (tk *guiWidget) GetText() string {
return "" return ""
} }
// hack. use "textbox widget" to "disable" user events
func hideDisable() { func hideDisable() {
if me.textbox.tk == nil { if me.textbox.tk == nil {
initTextbox() initTextbox()
me.textbox.tk.prepTextbox()
} }
me.textbox.tk.Hide() me.textbox.tk.Hide()
@ -177,7 +177,6 @@ func hideDisable() {
// me.baseGui.DeleteView(me.textbox.tk.v.Name()) // me.baseGui.DeleteView(me.textbox.tk.v.Name())
} }
// hack. use "textbox widget" to "disable" user events
func showDisable() { func showDisable() {
if me.textbox.tk == nil { if me.textbox.tk == nil {
initTextbox() initTextbox()

View File

@ -211,9 +211,7 @@ func (tk *guiWidget) refreshStdout() {
// chop off the last lines in the buffer // chop off the last lines in the buffer
chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h) chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h)
cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...) cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...)
if me.stdout.reverse { slices.Reverse(cur)
slices.Reverse(cur)
}
tk.v.Clear() tk.v.Clear()
fmt.Fprintln(tk.v, strings.Join(cur, "\n")) fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
} }

View File

@ -120,7 +120,6 @@ type stdout struct {
outputS []string // the buffer of all the output outputS []string // the buffer of all the output
pager int // allows the user to page through the buffer pager int // allows the user to page through the buffer
changed bool // indicates the user has changed stdout. gocui should remember the state here changed bool // indicates the user has changed stdout. gocui should remember the state here
reverse bool // flip the STDOUT upside down so new STDOUT lines are at the top
} }
// settings for the dropdown window // settings for the dropdown window

View File

@ -210,6 +210,13 @@ func (tk *guiWidget) makeWindowActive() {
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0) tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
/*
// print out the window list // TODO: put this in libnotify
for _, tk := range me.allwin {
log.Info("makeWindowActive() Window", tk.labelN, tk.window.active, tk.window.order)
}
*/
} }
func (tk *guiWidget) makeTK(ddItems []string) { func (tk *guiWidget) makeTK(ddItems []string) {