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/main.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 29ef024..43f3dc4 100644 --- a/src/main.c +++ b/src/main.c @@ -600,8 +600,6 @@ main(int argc, char **argv) teco_qreg_table_replace(&teco_qreg_table_globals, teco_qreg_plain_new("\e", 1)); teco_undo_enabled = TRUE; - teco_ring_set_scintilla_undo(TRUE); - teco_view_set_scintilla_undo(teco_qreg_view, TRUE); /* * FIXME: Perhaps we should simply call teco_cmdline_init() and @@ -633,9 +631,6 @@ main(int argc, char **argv) */ teco_undo_enabled = FALSE; teco_undo_clear(); - /* also empties all Scintilla undo buffers */ - teco_ring_set_scintilla_undo(FALSE); - teco_view_set_scintilla_undo(teco_qreg_view, FALSE); if (!teco_ed_hook(TECO_ED_HOOK_QUIT, &error)) goto cleanup; -- cgit v1.2.3