MCPcopy Create free account
hub / github.com/anus-dev/ANUS / pushUndo

Function pushUndo

packages/cli/src/ui/components/shared/text-buffer.ts:906–917  ·  view source on GitHub ↗
(currentState: TextBufferState)

Source from the content-addressed store, hash-verified

904const historyLimit = 100;
905
906export const pushUndo = (currentState: TextBufferState): TextBufferState => {
907 const snapshot = {
908 lines: [...currentState.lines],
909 cursorRow: currentState.cursorRow,
910 cursorCol: currentState.cursorCol,
911 };
912 const newStack = [...currentState.undoStack, snapshot];
913 if (newStack.length > historyLimit) {
914 newStack.shift();
915 }
916 return { ...currentState, undoStack: newStack, redoStack: [] };
917};
918
919export type TextBufferAction =
920 | { type: 'set_text'; payload: string; pushToUndo?: boolean }

Callers 1

handleVimActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected