From e371b5fc710c597e175e6b7d7645b3a224a731a1 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 25 Sep 2026 01:43:56 +0200 Subject: instead of relying on Scintilla undo actions, use SciTECO undo tokens exclusively Previously we were using both Scintilla undo actions and our own undo tokens and both had to be coordinated via `undo__teco_interface_ssm(SCI_UNDO, 0, 0)`. This was error prone since we have to predict when an undo action is actually generated. Furthermore, you had to update SCI_SETUNDOCOLLECTION on all buffers and the Q-Reg view whenever switching to and from interactive mode. Also, this probably wasted memory for the doubled undo bookkeeping. Now, we always set SCI_SETUNDOCOLLECTION(FALSE), even in interactive mode. teco_undo_view_insert() was introduced to undo text deletions. While this saves almost no lines of code, it's just a clearer and simpler architecture. --- src/interface.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/interface.h') diff --git a/src/interface.h b/src/interface.h index 9c3d31e..20d9773 100644 --- a/src/interface.h +++ b/src/interface.h @@ -286,6 +286,12 @@ teco_interface_get_character(gsize pos, gsize len) return teco_view_get_character(teco_interface_current_view, pos, len); } +static inline void +teco_undo_interface_insert(gsize pos, gsize len) +{ + return teco_undo_view_insert(teco_interface_current_view, pos, len); +} + /* * The following functions are here for lack of a better place. * They could also be in sciteco.h, but only if declared as non-inline -- cgit v1.2.3