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