Problem
Agents cannot correctly send arrow keys to background programs via process send-keys when the program uses application cursor key mode. This affects interactive CLI programs like vim, htop, and terminal games.
For example, when playing a snake.py game in a PTY session, the agent cannot control the snake's direction because arrow keys are not encoded correctly.
Programs send smkx (\x1b[?1h) to switch to application mode, expecting SS3 sequences (\x1bOA/B/C/D). But send-keys always sends CSI sequences (\x1b[A/B/C/D) which are for normal mode. Result: arrow keys don't work in application mode.
Technical Background
DECCKM (DEC Cursor Key Mode):
smkx (\x1b[?1h\x1b=) → application mode → SS3 sequences (\x1bOA/B/C/D)
rmkx (\x1b[?1l\x1b>) → normal mode → CSI sequences (\x1b[A/B/C/D)
Problem
Agents cannot correctly send arrow keys to background programs via
process send-keyswhen the program uses application cursor key mode. This affects interactive CLI programs likevim,htop, and terminal games.For example, when playing a snake.py game in a PTY session, the agent cannot control the snake's direction because arrow keys are not encoded correctly.
Programs send
smkx(\x1b[?1h) to switch to application mode, expecting SS3 sequences (\x1bOA/B/C/D). Butsend-keysalways sends CSI sequences (\x1b[A/B/C/D) which are for normal mode. Result: arrow keys don't work in application mode.Technical Background
DECCKM (DEC Cursor Key Mode):
smkx(\x1b[?1h\x1b=) → application mode → SS3 sequences (\x1bOA/B/C/D)rmkx(\x1b[?1l\x1b>) → normal mode → CSI sequences (\x1b[A/B/C/D)