feat: 空回车自动回到终端底部
This commit is contained in:
@@ -70,6 +70,13 @@ const sendCommand = () => {
|
|||||||
const command = currentSessionCommandInput.value; // 使用计算属性获取值
|
const command = currentSessionCommandInput.value; // 使用计算属性获取值
|
||||||
console.log(`[CommandInputBar] Sending command: ${command || '<Enter>'} `);
|
console.log(`[CommandInputBar] Sending command: ${command || '<Enter>'} `);
|
||||||
emitWorkspaceEvent('terminal:sendCommand', { 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 中的值
|
// 清空 store 中的值
|
||||||
if (activeSessionId.value) {
|
if (activeSessionId.value) {
|
||||||
updateSessionCommandInput(activeSessionId.value, '');
|
updateSessionCommandInput(activeSessionId.value, '');
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type WorkspaceEventPayloads = {
|
|||||||
'terminal:ready': { sessionId: string; terminal: XtermTerminal; searchAddon: any };
|
'terminal:ready': { sessionId: string; terminal: XtermTerminal; searchAddon: any };
|
||||||
'terminal:sendCommand': { command: string; sessionId?: string }; // sessionId 可选,用于指定目标,默认为 active
|
'terminal:sendCommand': { command: string; sessionId?: string }; // sessionId 可选,用于指定目标,默认为 active
|
||||||
'terminal:clear': void; // sessionId 可选,默认为 active
|
'terminal:clear': void; // sessionId 可选,默认为 active
|
||||||
|
'terminal:scrollToBottomRequest': { sessionId: string };
|
||||||
|
|
||||||
// Editor Events
|
// Editor Events
|
||||||
'editor:closeTab': { tabId: string };
|
'editor:closeTab': { tabId: string };
|
||||||
|
|||||||
Reference in New Issue
Block a user