Still doesn't work in Debian.
#
#termcapinfo xterm*|rxvt* ti@:te@
+# Use the alternate screen of the xterm-like terminal
+# https://unix.stackexchange.com/a/261939
+#termcapinfo xterm* 'ti=\E[?1049h:te=\E[?1049l'
+#termcapinfo rxvt* 'ti=\E7\E[?47h:te=\E[2J\E[?47l\E8'
+
+# Do not use the alternate screen at all
+# run `tput smcup; screen -S test; tput rmcup`
+#termcapinfo xterm*|rxvt* 'ti=:te='
+
# Enable non-blocking mode to better cope with flaky ssh connections.
defnonblock 5