do proper checks if we are on altscreen or not

fixes screen segfaults with `altscreen on` when using applications making
use of altscreen like mc when resizing screen window

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>