On Mon, Apr 28, 2025 at 08:44:23AM +0200, Johannes Altmanninger wrote:
> Git blame doesn't say why screen forwards the DCS payload.  My guess
> is that this is to allow the user to forward escape sequences to the
> underlying terminal

indeed, this is documented behavior

        $ info screen| grep 'ESC P\b' -A2
             ESC P                   (A)     Device Control String
                                             Outputs a string directly to the 
host
                                             terminal without interpretation.

We could change the patch to be more conservative, i.e. making screen
forward DCS payloads if it contains _any_ control character
(this is good enough because XTGETTCAP requests never contain
nonprintable characters).

I really wonder if anyone is using it for things other than control
characters.

If we can't safely change this, and if we don't find another
workaround, I think we should implement the XTVERSION command, to allow
programs to work around this issue. It should look something like

        $ printf '\033[>0q'; cat -v
        ^[P>|Screen version 5.0.0 (build on 2024-12-29 08:12:37)^[\^C

(coincidentally the response is also in DCS format but of course
it doesn't clash with screen's interpretation since it's *written*
by screen to be read by the user)

Reply via email to