#991503 screen outputs spaces when refreshing/attaching a window with "defbce on"

Package:
screen
Source:
screen
Description:
terminal multiplexer with VT100/ANSI terminal emulation
Submitter:
Vincent Lefevre
Date:
2026-05-21 23:43:01 UTC
Severity:
normal
#991503#5
Date:
2021-07-26 01:56:18 UTC
From:
To:
Debian bug 578729 has reappeared.

1. Create a .screenrc file with: defbce on
2. Start xterm (trimSelection must be false; this is the default).
3. Start screen in xterm.
4. Start Mutt with: mutt -F /dev/null -f /dev/null
5. Redisplay the window with C-a C-l (alternatively, create a new window
   with C-a c and go back to the first window with C-a o).
6. Select a blank line with a double-click.
7. Paste the blank line in some editor.

Result: 80 spaces (corresponding to the width of the terminal)
are pasted instead of just a newline character (LF).

The display.c source file still contains "bcechar = mchar_null;"
(which was in the fix for Debian bug 578729). So I suppose that
something else broke.

#991503#10
Date:
2026-05-20 21:02:14 UTC
From:
To:
Hi Vincent,

Can you please try to reproduce this bug with the latest unstable
(5.0.1-2)?

Thanks,
Peter Dey

#991503#17
Date:
2026-05-20 21:44:59 UTC
From:
To:
Control: found -1 4.9.1-3.1
Control: found -1 5.0.1-2
Control: tags -1 - moreinfo

I can reproduce it with both 4.9.1-3.1 and 5.0.1-2.

#991503#28
Date:
2026-05-20 21:51:35 UTC
From:
To:
FYI, I had already reported the same bug earlier in the past
in screen 4.0.3 (2010):

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578729

and this was fixed in a 4.1.0 prerelease (2011):

  - Fixes a bug with displaying blank spaces with bce on. (Closes: #578729,
    LP: #702094)

But apparently, the bug reappeared...

#991503#33
Date:
2026-05-21 11:16:18 UTC
From:
To:
Hi Vincent,

I retested this with clean chroots and your mutt/xterm reproduction
steps.

Tested versions:
- 4.1.0~20110819git450e8f3-1
- 4.2.0-1
- 5.0.1-2

Observed behaviour is consistent across all three:
- outer TERM=xterm         : no trailing spaces
- outer TERM=xterm-256color: trailing spaces to full line

So this does not appear to be a regression introduced in screen 4.8.x or
5.x.
It looks like longstanding TERM-dependent behavior, which can appear as
a regression when environments default to xterm-256color.
Somewhere between buster and trixie, the default TERM seems to have
changed from xterm to xterm-256color; making this appear as a
regression.

The fix to resolve #578729 (upstream commit 98bf413) still exists in
screen 5.x.

Given the interplay between screen, xterm, terminfo and mutt, I can't
say which package the bug lies in.

Cheers,
Peter Dey

#991503#44
Date:
2026-05-21 11:58:25 UTC
From:
To:
I've been using TERM=xterm-256color since December 2018, thus before
buster. But this was much after #578729 was closed anyway.

I suppose that only screen, xterm and terminfo settings are involved
by the redisplay (C-a C-l), which is important to trigger the problem.

#991503#49
Date:
2026-05-21 12:08:47 UTC
From:
To:
I forgot that I also tested in GNOME Terminal, also with
TERM=xterm-256color (note that GNOME Terminal does not have its own
terminfo settings; it rather emulates other terminals, like xterm),
and I can reproduce the bug there too. As a double-click selects
only one single space in GNOME Terminal, one needs to triple-click
to see the problem.

#991503#54
Date:
2026-05-21 12:57:07 UTC
From:
To:
Do you think you could write a minimal reproducer in a bash script?
I haven't been able to reproduce the same symptoms anywhere except for
mutt.

#991503#59
Date:
2026-05-21 19:15:40 UTC
From:
To:
along with the release date which includes this change:

commit 86ce25b620c52c9bdea94bf1185a274466f69b80
Author: Amadeusz Sławiński <amade@asmblr.net>
Date:   Fri Jul 7 18:39:34 2017 +0200

    separate handling of 16 color and 256 color escapes

    on xterm
    echo -e "\e[38;5;1mtest\e[1mtest"
    puts both 'test' strings in same color, however in screen, second one is
    bright

    do note that defbce on, may interfere with this

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

only screen.  The checkin comment describes a regression.

#991503#62
Date:
2026-05-21 19:15:40 UTC
From:
To:
along with the release date which includes this change:

commit 86ce25b620c52c9bdea94bf1185a274466f69b80
Author: Amadeusz Sławiński <amade@asmblr.net>
Date:   Fri Jul 7 18:39:34 2017 +0200

    separate handling of 16 color and 256 color escapes

    on xterm
    echo -e "\e[38;5;1mtest\e[1mtest"
    puts both 'test' strings in same color, however in screen, second one is
    bright

    do note that defbce on, may interfere with this

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

only screen.  The checkin comment describes a regression.

#991503#67
Date:
2026-05-21 21:11:17 UTC
From:
To:
I'm wondering what this was supposed to do. Anyway, screen 4.09.01
(at least) is buggy on the term-test.pl testcase found at

https://savannah.gnu.org/bugs/index.php?50601

(I'm still using "defbce on".)

I wanted to say that xterm is involved in the rendering, but it may
not be related to the problem. Concerning Mutt, it is not involved
at all with the redisplay (one can even quit Mutt before doing the
redisplay with C-a C-l... the same problem occurs).

#991503#72
Date:
2026-05-21 23:26:48 UTC
From:
To:
Xterm logging allowed me to find the escape sequences:

  screen sh -c 'printf "\e[40m\e[K\n\e[K\n\e[K\n"; sleep 999'

The 3 lines above the cursor (those generated by "\e[K\n") are
affected: no issues before a redisplay, and after a redisplay
(C-a C-l), sequences of spaces are generated.

#991503#77
Date:
2026-05-21 23:41:04 UTC
From:
To:
  screen sh -c 'printf "\e[40m\e[K\n\e[41m\e[K\n\e[49m\e[K\n"; sleep 999'

This does the following:
  * Set the background to black and erase the line.
  * Set the background to red and erase the line.
  * Set the background to the default and erase the line.

Since bce is on, each line is erase with the chosen background color.

Before redisplay, none of the lines are affected. After redisplay,
the first two lines (those with an explicit background color) are
affected, but not the third one (default background).