Serialize command, fix command history after reconnect

This commit is contained in:
Daniel Imms 2022-03-14 12:26:31 -07:00
parent 2ce4442722
commit 94dd4dbc57
2 changed files with 5 additions and 2 deletions

View file

@ -226,10 +226,11 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
}
serializeCommands(): ISerializedCommand[] {
const serialized = this.commands.map(e => {
const serialized: ISerializedCommand[] = this.commands.map(e => {
return {
startLine: e.marker?.line,
endLine: e.endMarker?.line,
command: e.command,
cwd: e.cwd,
exitCode: e.exitCode,
timestamp: e.timestamp
@ -239,6 +240,7 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
serialized.push({
startLine: this._currentCommand.commandStartMarker.line,
endLine: undefined,
command: '',
cwd: undefined,
exitCode: undefined,
timestamp: 0,
@ -265,7 +267,7 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
}
// Full command
const newCommand = {
command: '',
command: e.command,
marker,
endMarker: e.endLine !== undefined ? this._terminal.registerMarker(e.endLine - (buffer.baseY + buffer.cursorY)) : undefined,
timestamp: e.timestamp,

View file

@ -69,6 +69,7 @@ export interface ReplayEntry {
data: string;
}
export interface ISerializedCommand {
command: string;
cwd: string | undefined;
startLine: number | undefined;
endLine: number | undefined;