diff --git a/packages/cli/src/ui/components/shared/text-buffer.ts b/packages/cli/src/ui/components/shared/text-buffer.ts index 56ab575c96..a896a98624 100644 --- a/packages/cli/src/ui/components/shared/text-buffer.ts +++ b/packages/cli/src/ui/components/shared/text-buffer.ts @@ -2795,11 +2795,23 @@ export function textBufferReducer( newExpandedPaste = { ...newExpandedPaste, startLine: newStartLine }; } } + let newSelectionAnchor = newState.selectionAnchor; + if (newSelectionAnchor) { + const newAnchorRow = newSelectionAnchor[0] - excess; + if (newAnchorRow < 0) { + newSelectionAnchor = null; + } else { + newSelectionAnchor = [newAnchorRow, newSelectionAnchor[1]]; + } + } newState = { ...newState, lines: newLines, cursorRow: newCursorRow, expandedPaste: newExpandedPaste, + selectionAnchor: newSelectionAnchor, + undoStack: [], + redoStack: [], }; } diff --git a/packages/core/src/agents/local-invocation.ts b/packages/core/src/agents/local-invocation.ts index 771be7b68a..310b69a6db 100644 --- a/packages/core/src/agents/local-invocation.ts +++ b/packages/core/src/agents/local-invocation.ts @@ -262,6 +262,13 @@ export class LocalSubagentInvocation extends BaseToolInvocation< } if (updated) { + const MAX_RECENT_ACTIVITY = 100; + if (recentActivity.length > MAX_RECENT_ACTIVITY) { + recentActivity.splice( + 0, + recentActivity.length - MAX_RECENT_ACTIVITY, + ); + } const progress: SubagentProgress = { isSubagentProgress: true, agentName: this.definition.name,