Update useSshTerminal.ts
This commit is contained in:
@@ -49,37 +49,6 @@ export function createSshTerminalManager(sessionId: string, wsDeps: SshTerminalD
|
|||||||
terminalInstance.value = term;
|
terminalInstance.value = term;
|
||||||
searchAddon.value = addon; // *** 存储 searchAddon 实例 ***
|
searchAddon.value = addon; // *** 存储 searchAddon 实例 ***
|
||||||
|
|
||||||
// *** 监听搜索结果变化 ***
|
|
||||||
// if (searchAddon.value) {
|
|
||||||
// // *** 移除错误的类型注解,让 TS 推断 ***
|
|
||||||
// searchAddon.value.onDidChangeResults((results) => {
|
|
||||||
// // *** 添加更详细的日志 ***
|
|
||||||
// console.log(`[会话 ${sessionId}][SearchAddon] onDidChangeResults 事件触发! results:`, JSON.stringify(results)); // 使用 JSON.stringify 查看完整结构
|
|
||||||
// if (results && typeof results.resultIndex === 'number' && typeof results.resultCount === 'number') {
|
|
||||||
// // 确认 results 包含预期的数字属性
|
|
||||||
// searchResultCount.value = results.resultCount;
|
|
||||||
// currentSearchResultIndex.value = results.resultIndex; // xterm 的索引是从 0 开始的
|
|
||||||
// console.log(`[会话 ${sessionId}][SearchAddon] 状态已更新: index=${currentSearchResultIndex.value}, count=${searchResultCount.value}`);
|
|
||||||
// } else {
|
|
||||||
// // 没有结果、搜索被清除或 results 结构不符合预期
|
|
||||||
// console.log(`[会话 ${sessionId}][SearchAddon] 清除搜索状态或结果无效。 results:`, JSON.stringify(results)); // 使用 JSON.stringify 查看完整结构
|
|
||||||
// searchResultCount.value = 0;
|
|
||||||
// currentSearchResultIndex.value = -1;
|
|
||||||
// // console.log(`[会话 ${sessionId}][SearchAddon] 搜索结果清除或无匹配。`); // 这行日志有点重复,可以注释掉
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// // *** 添加确认日志 ***
|
|
||||||
// console.log(`[会话 ${sessionId}][SearchAddon] onDidChangeResults 监听器已附加。`);
|
|
||||||
// } else {
|
|
||||||
// console.warn(`[会话 ${sessionId}][SearchAddon] 无法附加 onDidChangeResults 监听器,searchAddon 实例为空。`);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// --- 添加日志:检查缓冲区处理 ---
|
|
||||||
// console.log(`[会话 ${sessionId}][SSH前端] handleTerminalReady: 准备处理缓冲区,缓冲区长度: ${terminalOutputBuffer.value.length}`);
|
|
||||||
// if (terminalOutputBuffer.value.length > 0) {
|
|
||||||
// console.log(`[会话 ${sessionId}][SSH前端] handleTerminalReady: 内部缓冲区内容 (前100字符):`, terminalOutputBuffer.value.map(d => d.substring(0, 100)).join(' | '));
|
|
||||||
// }
|
|
||||||
// ---------------------------------
|
|
||||||
|
|
||||||
// 1. 处理 SessionState.pendingOutput (来自 SSH_OUTPUT_CACHED_CHUNK 的早期数据)
|
// 1. 处理 SessionState.pendingOutput (来自 SSH_OUTPUT_CACHED_CHUNK 的早期数据)
|
||||||
const currentSessionState = globalSessionsRef.value.get(sessionId);
|
const currentSessionState = globalSessionsRef.value.get(sessionId);
|
||||||
@@ -439,9 +408,6 @@ export function createSshTerminalManager(sessionId: string, wsDeps: SshTerminalD
|
|||||||
// --- 暴露状态 ---
|
// --- 暴露状态 ---
|
||||||
isSshConnected: readonly(isSshConnected), // 暴露 SSH 连接状态 (只读)
|
isSshConnected: readonly(isSshConnected), // 暴露 SSH 连接状态 (只读)
|
||||||
terminalInstance, // 暴露 terminal 实例,以便 WorkspaceView 可以写入提示信息
|
terminalInstance, // 暴露 terminal 实例,以便 WorkspaceView 可以写入提示信息
|
||||||
// Removed search result state exposure
|
|
||||||
// searchResultCount: readonly(searchResultCount),
|
|
||||||
// currentSearchResultIndex: readonly(currentSearchResultIndex),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user