#711758 buffers not cleaned before creating full screen

Package:
xterm
Source:
xterm
Description:
X terminal emulator
Submitter:
Date:
2026-06-02 20:27:02 UTC
Severity:
minor
#711758#5
Date:
2013-06-09 13:39:10 UTC
From:
To:
I have no idea where to submit this.
xterm, bash, icewm, nodm, linux, terminfo?
A very very very heavily loaded system is the only place you can see
this, and only if you are lucky.
There I was in xterm,

I did
$ w3m file.html
$ ls; etc.
$ top

As the top(1) command starts 'painting' the screen,
one sees the beginning contents of the previous w3m screen momentarily,
and those contents were supposedly cleaned off the screen upon close of w3m.
even though w3m is no longer running.

I bet it is using some 'kernel buffers' or maybe just bad Terminfo
sequences. But please clear the buffer before making the "frame", even
if those first few characters will flash only momentarily.

#711758#10
Date:
2013-06-09 14:12:28 UTC
From:
To:
Sounds like xterm.  To keep the logic simple (this is long ago...), xterm does
the clear-screen operation right after switching between normal/alternate
screens.  The simplification is by reusing existing functions that do each
piece rather than write a special function that clears the buffer contents
while it is inactive.

#711758#15
Date:
2013-06-09 15:28:42 UTC
From:
To:
T> Sounds like xterm.  To keep the logic simple (this is long ago...), xterm does
T> the clear-screen operation right after switching between normal/alternate
T> screens.  The simplification is by reusing existing functions that do each
T> piece rather than write a special function that clears the buffer contents
T> while it is inactive.

Well ... call in security! The user thought that the contents of w3m had
safely disappeared from the screen before leaving the room, never
expecting that they would be shown to the next user, no matter how
briefly.

So do clear the contents please. It can't be that expensive.

#711758#20
Date:
2013-07-07 15:12:25 UTC
From:
To:
If the next user is going to use your xterm, you most likely have bigger
problems than that, and they could also get the contents by choosing
"Show Alternate Screen" from the menu (Ctrl+mouse-2).

The alternate screen buffer can be cleared with the commands
"tput smcup; tput rmcup".  Or maybe you want to set the
Xterm*titeInhibit resource to false to disable the alternate screen
altogether.

Cheers,
       Sven

#711758#25
Date:
2013-07-07 16:41:20 UTC
From:
To:
SJ> "Show Alternate Screen" from the menu (Ctrl+mouse-2).
Wow, I looked in there and found an old mutt session...!

#711758#30
Date:
2013-07-07 18:55:41 UTC
From:
To:
yes (I would have thought everyone knew that, but the level of discussion
on alternate screen tends to stop with titeInhibit).

that's a simple solution

(my change in #294 is still useful, of course)

#711758#35
Date:
2026-06-02 08:30:03 UTC
From:
To:
simpler to point out that the default configuration already does what's asked.

The terminal description uses

	smcup=\E[?1049h\E[22;0;0t,
	          ^^^^

As noted in the control sequences document:

            Ps = 1 0 4 9  -> Save cursor as in DECSC, xterm.  After
          saving the cursor, switch to the Alternate Screen Buffer,
          clearing it first.  This may be disabled by the titeInhibit
          resource.  This control combines the effects of the 1 0 4 7
          and 1 0 4 8  modes.  Use this with terminfo-based applications
          rather than the 4 7  mode.

I introduced 1049 in 1998.  The xterm-wannabe's all copied that (though
some don't clear the screen first, etc., that's not an "xterm" bug).

If you were using the

	smcup=\E7\E[?47h,

that's never going to clear the screen first.  Since there's no mention of
TERM in this report, it's the former case and this bug can be closed.

#711758#38
Date:
2026-06-02 08:30:03 UTC
From:
To:
simpler to point out that the default configuration already does what's asked.

The terminal description uses

	smcup=\E[?1049h\E[22;0;0t,
	          ^^^^

As noted in the control sequences document:

            Ps = 1 0 4 9  -> Save cursor as in DECSC, xterm.  After
          saving the cursor, switch to the Alternate Screen Buffer,
          clearing it first.  This may be disabled by the titeInhibit
          resource.  This control combines the effects of the 1 0 4 7
          and 1 0 4 8  modes.  Use this with terminfo-based applications
          rather than the 4 7  mode.

I introduced 1049 in 1998.  The xterm-wannabe's all copied that (though
some don't clear the screen first, etc., that's not an "xterm" bug).

If you were using the

	smcup=\E7\E[?47h,

that's never going to clear the screen first.  Since there's no mention of
TERM in this report, it's the former case and this bug can be closed.

#711758#43
Date:
2026-06-02 20:25:27 UTC
From:
To:
fwiw, this was mentioned in

                            Patch #294 - 2013/07/05

     * add  note  in ctlseqs.ms for CPR response pointing out a potential
       point  of  confusion  with  the  string  sent by a modified F1 key
       (suggested by Bram Moolenaar).
     * improve   plink.sh   by   checking  if  the  linker  supports  the
       --as-needed option (suggested by David Philippi).
     * improve  clearing  for  private  mode  1049  when switching to the
       alternate screen (Debian #711758).
     * amend  fix  from  [567]patch  #292  by removing now-unneeded chunk
       which introduced problem in selection (Debian #714527).
     * add  definition to optionally override compiled-in class for xterm
       from makefile, needed for test-packages.
     * add configure option --enable-sixel-graphics
     * add experimental support for sixel graphics (Ross Combs).

but overlooked in Debian, for which "apt changelog xterm" tells me that
patches 293 and 295 were noted, but not 294.

#711758#48
Date:
2026-06-02 20:26:13 UTC
From:
To:
close as noted 711758@bugs.debian.org
#711758#51
Date:
2026-06-02 20:25:27 UTC
From:
To:
fwiw, this was mentioned in

                            Patch #294 - 2013/07/05

     * add  note  in ctlseqs.ms for CPR response pointing out a potential
       point  of  confusion  with  the  string  sent by a modified F1 key
       (suggested by Bram Moolenaar).
     * improve   plink.sh   by   checking  if  the  linker  supports  the
       --as-needed option (suggested by David Philippi).
     * improve  clearing  for  private  mode  1049  when switching to the
       alternate screen (Debian #711758).
     * amend  fix  from  [567]patch  #292  by removing now-unneeded chunk
       which introduced problem in selection (Debian #714527).
     * add  definition to optionally override compiled-in class for xterm
       from makefile, needed for test-packages.
     * add configure option --enable-sixel-graphics
     * add experimental support for sixel graphics (Ross Combs).

but overlooked in Debian, for which "apt changelog xterm" tells me that
patches 293 and 295 were noted, but not 294.