aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--undo.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/undo.cpp b/undo.cpp
index da0b593..8072540 100644
--- a/undo.cpp
+++ b/undo.cpp
@@ -1,7 +1,9 @@
+#include <stdio.h>
#include <string.h>
#include <bsd/sys/queue.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include <Scintilla.h>
@@ -9,6 +11,8 @@
#include "interface.h"
#include "undo.h"
+//#define DEBUG
+
UndoStack undo;
void
@@ -21,6 +25,9 @@ void
UndoStack::push(UndoToken *token)
{
if (enabled) {
+#ifdef DEBUG
+ g_printf("UNDO PUSH %p\n", token);
+#endif
token->pos = strlen(cmdline);
SLIST_INSERT_HEAD(&head, token, tokens);
} else {
@@ -39,6 +46,10 @@ UndoStack::pop(gint pos)
{
while (!SLIST_EMPTY(&head) && SLIST_FIRST(&head)->pos >= pos) {
UndoToken *top = SLIST_FIRST(&head);
+#ifdef DEBUG
+ g_printf("UNDO POP %p\n", top);
+ fflush(stdout);
+#endif
top->run();