URL:
  <https://savannah.gnu.org/bugs/?68858>

                 Summary: SGR (1006) mouse events reach the window as \e[M<SGR
body> after reattaching
                   Group: GNU Screen
               Submitter: yourilima
               Submitted: Fri 30 Oct 2026 10:46:09 AM UTC
                Category: Program Logic
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: 5.0.2
           Fixed Release: None
         Planned Release: None
           Work Required: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 30 Oct 2026 10:46:09 AM UTC By: Youri <yourilima>
When a window enables SGR mouse reporting (\e[?1000h\e[?1006h) and the session
has been detached and reattached, screen passes mouse events to the window
with the wrong prefix. The terminal sends \e[<64;17;13M (wheel up at column
17, row 13), and the window receives \e[M64;17;13M: the X10 prefix \e[M
followed by the SGR parameters, with the < dropped.

Applications that parse mouse input read \e[M plus the next 3 bytes as an X10
event, then take the rest (17;13M) as typed text. Scrolling the wheel types
junk like 17;13M17;13M... into the application (seen with Claude Code, which
uses SGR mouse mode).

If the session is never detached (started attached), the same event comes
through unchanged as \e[<64;17;13M.

To reproduce (no .screenrc, tested with outer TERM=xterm-256color and
TERM=alacritty):

    screen -c /dev/null -dmS t sh -c 'stty raw -echo; printf
"\033[?1000h\033[?1006h"; cat -v'
    screen -c /dev/null -r t

Then scroll the mouse wheel. Expected output: ^[[<64;17;13M. Actual output:
^[[M64;17;13M.

To compare, run screen -c /dev/null -S t2 sh -c '...same command...' (attached
from the start, no -dm) and scroll: the events arrive correctly.

Environment: screen 5.0.2 (Arch Linux package 5.0.2-2), Linux 7.2, Alacritty
as the outer terminal, both locally and over ssh.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68858>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to