From 35717dea47093d116718bb5584ee341c0bb56210 Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Mon, 12 May 2025 20:04:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A9=BA=E5=9B=9E=E8=BD=A6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=9B=9E=E5=88=B0=E7=BB=88=E7=AB=AF=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/CommandInputBar.vue | 7 +++++++ packages/frontend/src/composables/workspaceEvents.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/packages/frontend/src/components/CommandInputBar.vue b/packages/frontend/src/components/CommandInputBar.vue index ed71f30..fc8aeb7 100644 --- a/packages/frontend/src/components/CommandInputBar.vue +++ b/packages/frontend/src/components/CommandInputBar.vue @@ -70,6 +70,13 @@ const sendCommand = () => { const command = currentSessionCommandInput.value; // 使用计算属性获取值 console.log(`[CommandInputBar] Sending command: ${command || ''} `); emitWorkspaceEvent('terminal:sendCommand', { command }); + + // 如果是空回车,并且有活动会话,则请求滚动到底部 + if (command.trim() === '' && activeSessionId.value) { + console.log(`[CommandInputBar] Empty Enter detected. Requesting scroll to bottom for session: ${activeSessionId.value}`); + emitWorkspaceEvent('terminal:scrollToBottomRequest', { sessionId: activeSessionId.value }); + } + // 清空 store 中的值 if (activeSessionId.value) { updateSessionCommandInput(activeSessionId.value, ''); diff --git a/packages/frontend/src/composables/workspaceEvents.ts b/packages/frontend/src/composables/workspaceEvents.ts index d5f1972..fe9321e 100644 --- a/packages/frontend/src/composables/workspaceEvents.ts +++ b/packages/frontend/src/composables/workspaceEvents.ts @@ -11,6 +11,7 @@ export type WorkspaceEventPayloads = { 'terminal:ready': { sessionId: string; terminal: XtermTerminal; searchAddon: any }; 'terminal:sendCommand': { command: string; sessionId?: string }; // sessionId 可选,用于指定目标,默认为 active 'terminal:clear': void; // sessionId 可选,默认为 active + 'terminal:scrollToBottomRequest': { sessionId: string }; // Editor Events 'editor:closeTab': { tabId: string };