Package: ncurses-bin
Version: 6.2+20210905-1
Severity: normal

By default, the "clear" command clears the screen, including its
scrollback buffer, as documented by the clear(1) man page.

However, when the current screen is the alternate screen, e.g. after
"tput smcup", the "clear" command clears both the alternate screen
and the scrollback buffer of the *main* screen. I'd say that this is
unexpected. The alternate screen does not have a scrollback buffer,
thus when it is the current screen, the "clear" command should not
clear the scrollback buffer.

Tested with xterm and GNOME Terminal.

To reproduce:

1. Open a terminal window, e.g. xterm or GNOME Terminal.
2. Type "seq 1 1000" to output 1000 lines from 1 to 1000.
   You can check the scrollback buffer at this point.
3. Type "tput smcup; clear; tput rmcup".

Result: the last lines of the "seq 1 1000" command are still visible,
but the scrollback buffer is gone.

Note: with mlterm and rxvt, the scrollback buffer is still there, but
this is just because the "clear" command doesn't clear it with these
terminals (whether the main screen is the alternate screen or not).

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.14.0-4-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ncurses-bin depends on:
ii  libc6      2.32-4
ii  libtinfo6  6.2+20210905-1

ncurses-bin recommends no packages.

ncurses-bin suggests no packages.

-- no debconf information

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to