forked from sloum/bombadillo
fixes screen display properly, better start location
This commit is contained in:
parent
86485154c9
commit
6faf4e5205
20
main.go
20
main.go
|
@ -146,15 +146,17 @@ func initClient() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// On SIGCONT, ensure the terminal is still in the correct mode
|
// In the event of SIGCONT, ensure the display is shown correctly. Accepts a
|
||||||
// Accepts the signal, does the work, then starts another instance
|
// signal, blocking until it is received. Once not blocked, corrects terminal
|
||||||
// to handle any future occurences of SIGCONT
|
// display settings. Loops indefinitely, does not return.
|
||||||
func handleSIGCONT(c <-chan os.Signal) {
|
func handleSIGCONT(c <-chan os.Signal) {
|
||||||
|
for {
|
||||||
<-c
|
<-c
|
||||||
cui.Tput("rmam") // turn off line wrapping
|
cui.Tput("rmam") // turn off line wrapping
|
||||||
cui.Tput("smcup") // use alternate screen
|
cui.Tput("smcup") // use alternate screen
|
||||||
cui.SetCharMode()
|
cui.SetCharMode()
|
||||||
go handleSIGCONT(c)
|
bombadillo.Draw()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -166,11 +168,6 @@ func main() {
|
||||||
}
|
}
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
|
|
||||||
// buffered channel to capture SIGCONT for handling
|
|
||||||
c := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(c, syscall.SIGCONT)
|
|
||||||
go handleSIGCONT(c)
|
|
||||||
|
|
||||||
// Build the mailcap db
|
// Build the mailcap db
|
||||||
// So that we can open files from gemini
|
// So that we can open files from gemini
|
||||||
mc = mailcap.NewMailcap()
|
mc = mailcap.NewMailcap()
|
||||||
|
@ -184,6 +181,11 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// watch for SIGCONT, send it to be handled
|
||||||
|
c := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(c, syscall.SIGCONT)
|
||||||
|
go handleSIGCONT(c)
|
||||||
|
|
||||||
// Start polling for terminal size changes
|
// Start polling for terminal size changes
|
||||||
go bombadillo.GetSize()
|
go bombadillo.GetSize()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue