feat: 空回车自动回到终端底部

This commit is contained in:
Baobhan Sith
2025-05-12 20:04:33 +08:00
parent 2876139c80
commit 35717dea47
2 changed files with 8 additions and 0 deletions
@@ -70,6 +70,13 @@ const sendCommand = () => {
const command = currentSessionCommandInput.value; // 使用计算属性获取值
console.log(`[CommandInputBar] Sending command: ${command || '<Enter>'} `);
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, '');