From 910d8a61772570198eb12f752c5b7f8fcd006dc2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 22 Nov 2026 16:53:08 +0100 Subject: implemented the FQq (free Q-register) command and extended EF Since Q-registers can be dynamically allocated, we must have a command for freeing them as well. This is especially important when using long Q-register names to implement arrays and other complex data structures. To ease freeing entire arrays, the :FQ[array.] modification can be used -- this will free all registers with the given prefix efficiently. There is currently no variant that tells you whether the register actually existed -- you can first check with :Qq if that is important. EF has also been extended to free the currently edited register - which is also what Video TECO appeared to do. If the currently edited register is freed, we edit the current buffer again. --- tests/testsuite.at | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/testsuite.at') diff --git a/tests/testsuite.at b/tests/testsuite.at index b0a3c55..ff6f509 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -227,6 +227,18 @@ TE_CHECK([[ [: @I/XXX/ ]: ."N(0/0)']], 0, ignore, ignore) TE_CHECK([[ [a :]a"F(0/0)' ![! :]a"S(0/0)']], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Freeing Q-Registers]) +TE_CHECK([[FQa :Qa"U(0/0)']], 0, ignore, ignore) +TE_CHECK([[10 :FQ[array.] :Q[array.8]"U(0/0)']], 0, ignore, ignore) +# Some register is always internal and forbidden to free. +TE_CHECK([[:FQ[] ]], 1, ignore, ignore) +TE_CHECK([[@I/ABC/ @EQa// FQa Z-3"N(0/0)']], 0, ignore, ignore) +TE_CHECK([[@I/ABC/ @EQa// EF Z-3"N(0/0)']], 0, ignore, ignore) +# Undoing local Q-reg operations is a common source of bugs. +TE_CHECK_CMDLINE([[@^Um{FQ.a} Mm{-2D}]], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +AT_CLEANUP + m4_define([TE_MAXINT32], [2147483647]) m4_define([TE_MININT32], [-2147483648]) m4_define([TE_MAXINT64], [9223372036854775807]) -- cgit v1.3