From e82dc6639e829490cb11267fa4a49ef97c6459ae Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 30 Aug 2025 20:38:57 +0300 Subject: the computed go-to command (O) is now 0-indexed and all invalid indexes and empty labels are ignored * This has long been a TECO-11 incompatibility. * The first label in a list has index 0, i.e. `1Ofoo,bar$` jumps to label `!bar!`. Consequently 0 is also implied, so `Olabel$` continues to do what you expect. * `0Ofoo$` was previously also jumping to `!foo!` which was inconsistent: All invalid indexes should do nothing, i.e. execution continues after the go-to command. * Fixed handling of empty labels as in `1Ofoo,,bar$` - execution should also continue after the command. This eases writing "default" clauses immediately after the go-to. * The ED hook values now also begin at 0, so most existing ED hook macros should continue to work. * Similarily, the mouse events returned by -EJ also begin at 0 now, so fnkeys.tes continues to work as expected. * It's still very possible of course that this breaks existing code. --- tests/testsuite.at | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/testsuite.at') diff --git a/tests/testsuite.at b/tests/testsuite.at index 3728723..3cca113 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -114,6 +114,14 @@ TE_CHECK([[3<%a:>-3"N(0/0)' $]], 0, ignore, ignore) TE_CHECK([[3<%a :F>(0/0):>-3"N(0/0)' $]], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Gotos and labels]) +TE_CHECK([[@O//]], 1, ignore, ignore) +TE_CHECK([[^^XUq @O/s.^EUq/ (0/0) !s.X!]], 0, ignore, ignore) +TE_CHECK([[1@O/foo,bar/ (0/0) !bar!]], 0, ignore, ignore) +# No-op gotos +TE_CHECK([[-1@O/foo/ 1@O/foo/ @O/,foo/]], 0, ignore, ignore) +AT_CLEANUP + AT_SETUP([String arguments]) TE_CHECK([[Ifoo^Q]]TE_ESCAPE[[(0/0)]]TE_ESCAPE, 0, ignore, ignore) TE_CHECK([[@I"foo^Q"(0/0)"]], 0, ignore, ignore) -- cgit v1.2.3