From 6b7ab7d05725f0d20c45b7cda10b25e4e07ab2d6 Mon Sep 17 00:00:00 2001 From: chaoszhu Date: Sun, 5 Jul 2026 11:52:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20native=E7=BB=88=E7=AB=AF=E9=94=AE?= =?UTF-8?q?=E7=9B=98=E5=94=A4=E8=B5=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/terminal/terminal_shell_page.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/native/lib/features/terminal/terminal_shell_page.dart b/native/lib/features/terminal/terminal_shell_page.dart index 16d2699..21179e3 100644 --- a/native/lib/features/terminal/terminal_shell_page.dart +++ b/native/lib/features/terminal/terminal_shell_page.dart @@ -59,7 +59,14 @@ class _TerminalShellPageState extends ConsumerState { setState(() => _allowTerminalFocus = true); WidgetsBinding.instance.addPostFrameCallback((_) { if (!mounted) return; - _terminalFocusNode.requestFocus(); + // 系统键盘可能是用户手动收起的,此时 FocusNode 仍然 hasFocus, + // 单纯 requestFocus() 是空操作,必须走 requestKeyboard() 才能强制重新 show() + final activeSession = _manager.activeSession; + if (activeSession != null) { + activeSession.viewKey.currentState?.requestKeyboard(); + } else { + _terminalFocusNode.requestFocus(); + } }); Future.delayed(const Duration(milliseconds: 500), () { if (mounted && _showKeyPanel) { @@ -221,6 +228,12 @@ class _TerminalShellPageState extends ConsumerState { details.globalPosition, ); if (offset == null) return; + // 点击命中链接时走原有的打开链接流程;未命中链接时兜底尝试唤起键盘—— + // 覆盖 xterm 内部 _onTapDown 在残留选区场景下不会请求键盘的情况,requestKeyboard() 本身幂等 + if (_extractUrlAtOffset(session, offset) == null) { + session.viewKey.currentState?.requestKeyboard(); + return; + } _onTerminalTap(session, offset); }