Skip to content

Commit 90da568

Browse files
authored
drop redo entries when writing new snapshots into history (microsoft#251299)
* drop redo entries when writing new snapshots into history * undo unwanted changes
1 parent 086501e commit 90da568

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio
420420
const linearHistoryPtr = this._linearHistoryIndex.get();
421421
const newLinearHistory: IChatEditingSessionSnapshot[] = [];
422422
for (const entry of this._linearHistory.get()) {
423-
if (linearHistoryPtr - entry.startIndex < entry.stops.length) {
423+
if (entry.startIndex >= linearHistoryPtr) {
424+
// all further entries are being dropped
425+
break;
426+
} else if (linearHistoryPtr - entry.startIndex < entry.stops.length) {
424427
newLinearHistory.push({ requestId: entry.requestId, stops: entry.stops.slice(0, linearHistoryPtr - entry.startIndex), startIndex: entry.startIndex, postEdit: undefined });
425428
} else {
426429
newLinearHistory.push(entry);

0 commit comments

Comments
 (0)