Ensure less clears screen
Normally less
"clears the screen" (which probably refers to switching back to the normal screen from the alternate screen) when the terminal description has the appropriate escape sequence in the rmcup
capability.
You would see a difference if you are using different values of TERM
in the two programs. The infocmp
program can show differences for the corresponding terminal descriptions.
less
also attempts to clear the remainder of the screen, but that depends upon whether anything was displayed, and if the output was a terminal (in contrast to a pipe).
Aside from the terminal description, some terminal emulators make it optional whether to allow the alternate screen. You may have selected that option at some point. (I'm testing with default configuration, which works as intended).