How is terminal state saved/restored when process is put in background and then in foreground again? I'm reading https://www.gnu.org/software/libc/manual/html_node/Foreground-and-Background.html which gave me idea that tcgetattr/tcsetattr are responsible for this, but parameters like cursor configuration, alternate (cup) mode are not put in termios struct. I've managed to verify that with simple test code:
struct termios t;
tcgetattr( 0, &t);
// change something
tcsetattr(0, TCSANOW, &t);
Or maybe process repaints terminal itself after being put in foreground with SIGCONT signal? I've tried to send it manually to some programs, but couldn't really tell if it repainted.