From 107fe8942c992296f629405d786c12f2282015cf Mon Sep 17 00:00:00 2001 From: TomZz Date: Fri, 12 Jun 2026 00:31:41 +0800 Subject: [PATCH] Add reconnection prompt overlay on unexpected SSH disconnect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 SSH 会话意外断线时复用 connection_progress 显示错误信息 - 区分正常退出与异常断线,避免用户主动执行 exit 时弹出重连提示 - 接入已有的重连 (Retry) 和 取消 (Cancel) 逻辑,允许用户在断线后一键恢复会话 --- src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.rs b/src/main.rs index 9d3cbb9..8189c3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -479,6 +479,7 @@ impl Ashell { if self.active_tab.as_deref() == Some(tab_id.as_str()) { self.system_status = Some(reason.clone().into()); } + let is_graceful_exit = reason == "Terminal process exited" || reason == "SSH session exited"; if let Some(progress) = self.connection_progress.as_mut() { if progress.tab_id == tab_id { progress.lines.push(reason.clone().into()); @@ -487,6 +488,15 @@ impl Ashell { progress.title = t!("connection_failed").into(); progress.failed = true; } + } else if let Some(_) = session_label { + if !is_graceful_exit { + self.connection_progress = Some(ConnectionProgress { + tab_id: tab_id.clone(), + title: t!("connection_failed").into(), + lines: vec![reason.clone().into()], + failed: true, + }); + } } self.status = reason.into(); }