fix: 修复空输入框 Ctrl+C 导致的多余空行
This commit is contained in:
@@ -183,9 +183,13 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
if (terminalManager && typeof terminalManager.sendData === 'function') {
|
if (terminalManager && typeof terminalManager.sendData === 'function') {
|
||||||
const commandToSend = command.trim();
|
const commandToSend = command.trim();
|
||||||
console.log(`[WorkspaceView] Sending command to active session ${currentSession.sessionId}: ${commandToSend}`);
|
console.log(`[WorkspaceView] Sending command/data to active session ${currentSession.sessionId}: ${JSON.stringify(command)}`); // Log raw command
|
||||||
terminalManager.sendData(command + '\r');
|
// Only append '\r' for regular commands, not for control characters like Ctrl+C (\x03)
|
||||||
if (commandToSend.length > 0) {
|
const dataToSend = command === '\x03' ? command : command + '\r';
|
||||||
|
terminalManager.sendData(dataToSend);
|
||||||
|
// Add to history only if it's a user-typed command (not just Enter or control chars)
|
||||||
|
const commandToHistory = command.trim();
|
||||||
|
if (commandToHistory.length > 0 && command !== '\x03') {
|
||||||
commandHistoryStore.addCommand(commandToSend);
|
commandHistoryStore.addCommand(commandToSend);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user