Skip to content

Conversation

@majiayu000
Copy link

Summary

  • Set TERM=xterm-256color environment variable when spawning PTY shell
  • This ensures proper handling of terminal control sequences

Problem

Delete/Backspace keys were not working in terminal connections, particularly when connecting from iPad to Linux.

Root cause: The PTY was spawning shell without setting the TERM environment variable, causing the shell to not properly interpret certain control character sequences.

Solution

Added cmd.env("TERM", "xterm-256color") in terminal_service.rs before spawning the shell process. This tells the shell it's running in an xterm-compatible terminal, enabling proper handling of:

  • Delete key (\x7f)
  • Backspace key
  • Arrow keys and other special keys

Test plan

  • Connect from iPad to Linux via terminal
  • Type text and press Delete/Backspace
  • Verify characters are correctly deleted
  • Run echo $TERM and verify output is xterm-256color

Fixes #13621

Set TERM=xterm-256color when spawning PTY shell to ensure proper
handling of control sequences. This fixes the issue where Delete/
Backspace keys were not working in terminal connections, particularly
from iPad to Linux.

Fixes rustdesk#13621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete-key not working inside terminal

1 participant