Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 1.04 KB

undo.org

File metadata and controls

46 lines (38 loc) · 1.04 KB

Undo

Header

#ifndef UNDO
#define UNDO

#include "zipperBuffer.h"

typedef struct UndoStack UndoStack;

struct UndoStack {
  RowList *forwards;
  RowList *backwards;
  int cursorX;
  int cursorY;
  UndoStack *tail;
};


UndoStack *undoCons(RowList *forwards,
                    RowList *backwards,
                    int cursorX,
                    int cursorY,
                    UndoStack *tail);

#endif

Body

#include "undo.h"

UndoStack *undoCons(RowList *forwards,
                    RowList *backwards,
                    int cursorX,
                    int cursorY,
                    UndoStack *tail) {
  UndoStack *new = malloc(sizeof(*new));
  new->tail = tail;
  new->forwards = forwards;
  new->backwards = backwards;
  new->cursorX = cursorX;
  new->cursorY = cursorY;
  return new;
}