1

How does the man program manage to restore previous terminal output after taking over the entire screen? Does it involve ANSI escape sequences in a way?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
TechDragon
  • 149
  • 1
  • 7

1 Answers1

2

That is the ubiquitous xterm alternate-screen feature, which most terminal programs use via the terminfo smcup and rmcup sequences. For recent comments on this feature:

(By the way, the man program is usually a "termcap" program).

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Heh. I use a custom terminfo entry with empty `smcup`/`rmcup` fields just so I can stop programs from switching to an alternate screen. I hate it when I quit, say, `less` and the whole text I was looking at is just gone. – melpomene Jul 28 '15 at 21:25