tcell
tcell copied to clipboard
Does Suspend require any special screen handling?
trafficstars
System: Linux riis 6.8.0-52-generic #53~22.04.1-Ubuntu
I have the following code snippet in my application for suspension.
err := screen.Suspend()
if err != nil {
return fmt.Errorf("suspend: %v", err)
}
err = syscall.Kill(syscall.Getpid(), syscall.SIGSTOP)
if err != nil {
return fmt.Errorf("suspend: %v", err)
}
err = screen.Resume()
if err != nil {
return fmt.Errorf("suspend: %v", err)
}
However, it sometimes works incorrectly. After bringing the application back, using the fg command, I lose control over my application. Sometimes the screen displays half of the shell session and half of my application. Sometimes, I can see pressed key in the right down corner of the screen. The behavior is not deterministic, and I lack ideas how to debug this issue. I have tested this on multiple terminal emulators, and the behavior is buggy in all of them.