From bba57069a892ea91234b24622a260946d353d735 Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Wed, 24 Dec 2025 18:18:51 +0800 Subject: [PATCH] fix: set TERM env variable for terminal to fix Delete key not working (#13747) 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 #13621 --- src/server/terminal_service.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/terminal_service.rs b/src/server/terminal_service.rs index 945ae27bd..959d387f5 100644 --- a/src/server/terminal_service.rs +++ b/src/server/terminal_service.rs @@ -774,6 +774,11 @@ impl TerminalServiceProxy { #[allow(unused_mut)] let mut cmd = CommandBuilder::new(&shell); + // Set TERM environment variable to ensure proper handling of control sequences + // This fixes issues with Delete/Backspace keys not working correctly + // See: https://github.com/rustdesk/rustdesk/issues/13621 + cmd.env("TERM", "xterm-256color"); + #[cfg(target_os = "windows")] if let Some(token) = &self.user_token { cmd.set_user_token(*token as _);