SSH terminal session disconnects on OSC 52 "clear selection" sequence

SSH terminal session disconnects on OSC 52 "clear selection" sequence

avatar

RDM version: 2026.3.16.0 64-bit (JIT)

OS: Windows 11 Enterprise 25H2

Session type: SSH Shell (embedded terminal)

Remote host: RHEL 8.10, TERM=xterm-256color

Summary

The embedded SSH terminal immediately disconnects the session when it receives an OSC 52 sequence whose payload is "!". Per the xterm spec, a payload that is neither base64 nor "?" means "clear the selection," so the terminal should clear the selection or ignore the sequence, not drop the session.

Steps to reproduce

1. Open an SSH session to a Linux host in RDM.

2. Run: printf '\e]52;p;!\e\\'

3. The session disconnects immediately.

What does work

- OSC 52 writes succeed with both the "c" and "p" targets and with both BEL and ST terminators. For example, printf '\e]52;c;%s\a' "$(printf hello | base64)" places "hello" on the Windows clipboard correctly.

- An OSC 52 query (printf '\e]52;c;?\a') does not disconnect, though the reply appears malformed (shows as ^[]52^G).

Additional results

The disconnect happens for any OSC 52 clear request, regardless of target or terminator:

- printf '\e]52;p;!\e\\' (p target, ST terminator): disconnects

- printf '\e]52;c;!\e\\' (c target, ST terminator): disconnects

- printf '\e]52;p;!\a' (p target, BEL terminator): disconnects

Real-world impact

The micro text editor (v2.0.15) with clipboard set to "terminal" sends this clear sequence before every copy, so any copy or selection in micro kills the SSH session. Other terminal applications that clear the selection via OSC 52 are likely affected too.

Expected behavior

Clear the selection (or ignore the sequence) and keep the session connected. Ideally, also return a well-formed reply to OSC 52 queries, or ignore them.

All Comments (1)

avatar

Hello,

Thank you for contacting Devolutions Support, and thank you for the detailed report and test results.

Could you send a screenshot of the Advanced section of your SSH Shell entry properties, plus any other terminal setting you changed from the default?

Could you also confirm whether copying in micro worked without disconnects in an earlier RDM version, and if so, which version?

Let me know,

Best regards,

Samuel Dery