aboutsummaryrefslogtreecommitdiffhomepage
path: root/goto.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 03:33:06 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 06:07:34 +0100
commit2d31c1c5f08bbe19faf0e874604517fb67dc5ee7 (patch)
tree68c9cc91ad443e5f257861f6e56e4036aeafaf69 /goto.h
parentf797b2c8e30a4a6f9370db293289a158729b2525 (diff)
downloadsciteco-2d31c1c5f08bbe19faf0e874604517fb67dc5ee7.tar.gz
fixed rubout of macro invocations: goto tables and q-registers are allocated on the C++ call stack and configured to not emit undo tokens
this introduces additional logic but has the huge advantage that the tables can be freed after the macro invocation. if undo tokens were emitted, the tables had to be kept in the undo stack so they can be restored during rubout. this however would be both complicated and unnecessarily inefficient since the tables would reach their initial state during rubout and be deallocated anyways. * similar (but not strictly necessary optimizations) can be performed for macro invocations * also wrapper Q-Register setting/getting -> will allow a custom "*" register getter (e.g. calculates buffer position on the fly)
Diffstat (limited to 'goto.h')
-rw-r--r--goto.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/goto.h b/goto.h
index 146bade..6275d34 100644
--- a/goto.h
+++ b/goto.h
@@ -53,8 +53,13 @@ class GotoTable : public RBTree {
}
};
+ /*
+ * whether to generate UndoTokens (unnecessary in macro invocations)
+ */
+ bool must_undo;
+
public:
- GotoTable() : RBTree() {}
+ GotoTable(bool _undo = true) : RBTree(), must_undo(_undo) {}
gint remove(gchar *name);
gint find(gchar *name);
@@ -63,7 +68,8 @@ public:
inline void
undo_set(gchar *name, gint pc = -1)
{
- undo.push(new UndoTokenSet(this, name, pc));
+ if (must_undo)
+ undo.push(new UndoTokenSet(this, name, pc));
}
#ifdef DEBUG