aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
8 dayssupport floating point numbersRobin Haberkorn2-12/+30
* Extends the SciTECO type system. A number on the expression stack or in a Q-register can be either an integer or a float. * Floating point constants begin with a digit (like all other numbers), are followed by a `.` and an optional fractional part. Exponents cannot currently be written. E.g. `1.` == `1.0`. But `.0` would still be `.,0`. (!) To push an integer followed by dot, you must now write e.g. `1,.` or `1 .`. * All of the basic arithmetic operators operate like this: If both operands are integers, the result is also an integer (integer arithmetics). If at least one of the operands is a float, the result is also a float (float arithmetics). * All of the binary operators (AND, OR, XOR) always cast all operands to integer and the result is always an integer as well. * You can "cast" integers to float by `*1.` or `/1.`. You can "cast" floats to integers using `#0`. * Most commands still accept only integers. Floats are implicitly casted to integers. Float-aware commands are: =, \, ^W, Qq, Uq, %q and the conditionals. * `%q` will not change the current type of register q. * Numeric part of "lexer.font" is now a float (in points). * You cannot currently print octal and hexadecimal floats. `==` and `===` are identical to `=` on floats. * `===` is now printing hex integers in lower case. This is because SciTECO's coding style for hex constants is also lower case. * `--with-teco-integer` renamed to `--with-teco-number`.
2026-10-25numbers are separate parser states and there are syntactic octal and ↵Robin Haberkorn1-0/+9
hexadecimal constants now * Instead of every digit being a stack-modifying standalone command, there is a single continuous parser state (teco_state_number) now - even though it has certain unique characteristics. They are consequently documented in the ARITHMETICS AND EXPRESSIONS chapter of sciteco(7). * A number will therefore be rubbed out entirely by CTRL+W, including a possible @-modifier. * (!) Spaces within constants are no longer ignored, but will push separate numbers to the stack instead (`1 2 3` pushes 3 numbers). The significance of the `,` operator is thus further reduced. * (!) You can no longer "append" to numbers on the stack as in `Qa001` - this was never actually used and caused more confusion. * (!) Digits outside the current radix are no longer accepted. E.g. digit 2 after `2^R`. This feature was also never used. * (!) Octal constants are supported with leading zeros as in C. This works regardless of the current radix set via `8^R` or `^O`. It remains to see whether this is actually useful or is rather annoying (since every constant beginning with 0 is automatically octal, you cannot left-pad arbitrary numbers with 0). * Hexadecimal constants are supported by at-modifying them as in `@0ff`. They must still begin with a digit 0-9 and since A-F are valid SciTECO commands, you may need additional spaces to separate hexadecimal constants from regular commands as in `@0ff D`. During syntax highlighting the number style is extended back to the at-sign. Note: Hexadecimal constants couldn't have been realized via `16^R` (or some shortcut) since that depends on runtime state, but we must know during parsing whether symbols A-F are part of the number of regular SciTECO commands. * The new hexadecimal constants are used in the color schemes now. Thanks to them, we no longer need workarounds like the "color.rgb" macro. * Since numbers don't have a dedicated terminator character, but any letter may terminate it, the number state must behave similar to a start state. Consequently, hexadecimal constants will currently be auto-case-folded if you enabled this feature. I recommend not to write hex constants in upper-case, though. Perhaps this should be worked around with a custom process_edit_cmd() callback. * Test suite updated
2026-10-21fixed rubbing out radix changes (^O/^D/^R)Robin Haberkorn1-0/+5
This was missing the undoing after the refactoring in a53fa85dabdfc2c47ec0c9e6626ddda2379a8e38.
2026-10-14help topics no longer need to be unique and can be toggled through with the ↵Robin Haberkorn1-4/+5
`?$` command. * This mirrors how the `FT$` command toggles through several results. * Some non-unique .SCITECO_TOPICs have been added to sciteco(1) and sciteco(7). * This works by inserting non-unique keys into the help topic RB tree - or rather by turning filename:pos also into keys since rb3ptr does not allow non-unique keys. When searching for a topic, we sort lower than any other entry with the same name. This way we can easily iterate all entries with the same name (search topic). The alternative would have been to maintain a linked list in each and every teco_help_topic_t. * teco_rb3str_auto_complete() now filters out possible duplicate keys. * Updated test case: check for non-unique topic names.
2026-10-04automatically disable ^G modifier after successful auto-completionsRobin Haberkorn1-0/+7
This will be important once we're doing LSP auto-completions. Until a completion is complete, we do NOT want to disable the modifier however since otherwise it can be disabled after a partial completion if there happened to be a rubbed out command line. Discarding a rubbed out command line consequently no longer disables the modifier as well. Any change of the modifier is now logged with an Info-level message. Some rudimentary test case has been added for rub-in via ^G.
2026-09-27^E at the end of a line in a string argument "swallows" the EOL characterRobin Haberkorn1-0/+2
This is similar to `\` at the line end in many languages like C and allows you to split a very long string argument over several lines without adding the EOL characters themselves. The TECO equivalent to `\` would be ^Q, but it would be a semantic exception since ^Q (escaping) is supposed to _preserve_ the value of the following character. Therefore I decided to use ^E instead. This works with DOS and Mac line breaks as well.
2026-08-18don't crash on `0N...$`, but always throw an errorRobin Haberkorn1-1/+2
See also 8a8edaa2daf37f7c12e21b9199755b5de8e489f5.
2026-08-10testsuite: added test case for help command (`?`)Robin Haberkorn1-13/+20
2026-08-07don't crash on `0S...$`, but always throw an errorRobin Haberkorn1-0/+2
* This has been broken for some time, but it didn't crash in v2.5.2. * Even when it did not crash, the search just failed. In TECO-11 (judging by TECOC), we must throw an error, though. Video TECO on the other hand always succeeds in such cases. * Added test case
2026-08-05fixed dot after an unsuccessful interactive searchRobin Haberkorn1-0/+5
If you had a partial success during interactive searching, dot would be left at that position since the failure handling only reset via SCI_GOTOPOS. This is now fixed by restoring the initial dot in glyphs as well. All existing occurrences of "dot" have been renamed to "pos" for consistency. (Nowadays, "dot" should be reserved for glyph positions since this is what `.` returns. Especially if both kinds of positions are used in the same code.) A test case has been added. This has been broken since 685507922b0b75da5935076395a5b1ec1ef58356.
2026-07-26`A` without arguments is now equivalent to `0A`Robin Haberkorn1-0/+4
* It was equivalent to `1A` which is almost never what you want. I doubt that any existing macros would be broken by this. But neither do I replace all `0A` in the existing code base (yet). * `A` without arguments is a completely different "append" command in TECO-11, but it doesn't make sense in SciTECO and I don't see what else `A` could be repurposed for. It cannot be made an insertion command since it depends on the stack state which we don't track in parse-only mode. * Added test case.
2026-07-26conditionals can be terminated with F" now in addition to a single-quote (')Robin Haberkorn1-0/+5
This is useful when writing small macros directly on the command-line as in `sciteco --eval`. If you use double quoted shell strings, too many characters have to be escaped. If you use single-quotes, though, embedding the conditional end (') is annoying -- it would have to be written as '\''.
2026-07-26implemented E*q to store the last command lineRobin Haberkorn1-0/+7
`*q` can only be used at the very beginning of the command line. We cannot support it everywhere as Video TECO did since we do not follow the operators in parse-only mode. `E*q` is a replacement, so you can store the previous command line at any later point. This also adds a test case.
2026-07-25revised and improved the Unicode glyph-to-byte conversion heuristicsRobin Haberkorn1-3/+6
Previously almost all glyph-to-byte offset conversions consulted Scintilla's line index and counted characters on the resulting line. For instance a simple expression like `.+1J` would scan the same line twice completely, which would be very slow on pathologically long lines. Even insertions did that due to having to update the ^Y ranges. If you repeat such an operation over all characters as in `<.+1:J;>` you would have complexity O(n^2) for n = line length. Only commands with an explicit relative nature like `C` and `A` would use teco_view_glyph2bytes_relative() which scans beginning at dot as long as the relative movement is less than 1024 glyphs. Wit the new heuristics almost all glyph-to-byte and byte-to-glyph conversions can make use of that optimization. This requires that dot must at all times be known in glyphs as well - the byte position is managed by Scintilla (SCI_GETCURRENTPOS). We therefore introduced teco_current_doc_set_dot() and teco_current_doc_get_dot() to update dot in the current buffer or Q-Register -- it cannot be stored along with the view since Q-Registers share a single view. A number of auxiliary functions have been introduced for converting relative to a known (glyphs,bytes) offset pair and for converting absolute and relative positions with regard to the current doc and SCI_GETCURRENTPOS position. Of course this is error-prone since the glyph and dot positions are interdependant - they must always be kept in sync. With these new optimizations even pathologically long lines can (usually) be managed even in UTF-8 documents. It does not address slow-downs in Scintilla's line layout, yet. grosciteco.tes for instance runs twice as fast now.
2026-07-24fixed lexer initialization if $SCITECOPATH happens to contain glob charactersRobin Haberkorn1-0/+7
* Always use ^ENq instead of ^EQq in the first argument of `EN`. * Added a "Globbing" test case - globbing was undertested anyway.
2026-07-24fixed case-insensitive searches with non-ANSI (Unicode) patternsRobin Haberkorn1-5/+5
* Since case-insensitivity is the default, you couldn't effectively search for non-ANSI characters, although character classes were not affected. * This was a terex bug, i.e. wasn't broken in v2.5.2. * Test cases have been added. The test case for searching for ^E (5) has been simplified using `^E<5>`.
2026-06-29implemented the ^~ pattern match construct: the rest of the pattern will be ↵Robin Haberkorn1-0/+4
an Advanced Regular Expression * Allows searching by regular expressions. We will never support all ARE constructs in TECO patterns, so this is useful to have available. * Can only be typed upcaret. This leaves ^E~q available as an escape-regexp string building construct. * Once we replace the pattern2regexp converter with a custom terex lexer, we might want to restrict ^~ to the beginning of the pattern. Currently, however it can be anywhere, so you can mix TECO patterns with regular expressions.
2026-06-28fixed block-wise backwards searchesRobin Haberkorn1-0/+1
The calculation of the block start was faulty and could cause underflows resulting in unpredictable behavior.
2026-06-28fixed ^EGq (character class) pattern construct for embedded null bytes and `-`Robin Haberkorn1-0/+5
This was using g_regex_escape_string() which always translates a null byte to `\0`, which is ambiguous if followed by other digits, so a null byte followed by a digit would result in a wrong regular expression. Actually the same could happen outside of character classes, ie. `@S/^@1/` was also broken. Also it does not escape `-`, so the result cannot be used in character classes. This is fixed now in a new custom implementation teco_regex_escape(). Once moving to a custom terex lexer, we won't need any of this of course unless we want to provide a regex escaping string building construct. We are now completely free of GRegex.
2026-06-28terex is the new regular expression engine now and replaces PCRE (GRegex)Robin Haberkorn1-18/+18
* terex is based on Henry Spencer's regular expression engine for Tcl. It is a hybrid NFA/DFA design which has better worst-time runtimes than the backtracking PCRE. Memory usage is also limited and can no longer increase catastrophically. * It should no longer be possible to crash SciTECO with pathological searches. * Since it reliably supports partial matches (REG_EXPECT) we can now enable the new backwards-search algorithm by default. This used to be broken because of a glib bug, which I already fixed. It would however take a long time until this ends up on the majority of glib installations. * Regexp executions can still be quite slow if you are looking for a pattern at the end of a huge file, which can hang the editor, but this can now at least theoretically be solved by adding hooks into terex to poll for interruptions. * We can now also get rid of a TECO-pattern to regexp translation step by directly generating terex tokens (TODO). * Performance-wise terex appears to be slower than PCRE for simple forward searches even when linking everything with optimzations (FIXME). * Having a stand-alone regular expression engine is also a huge step in getting rid of glib. See also: https://git.fmsbw.de/terex/about/
2026-06-14monkey-test: use `I^P` instead of old `EI` (renamed in v2.5.0)Robin Haberkorn1-1/+1
2026-05-31implemented but disabled block-wise backwards search algorithmRobin Haberkorn1-5/+12
* The block-wise search algorithm allows for efficient backwards searches on large files. * On the downside the results are not entirely symmetric to forward searches. It therefore makes sense to still support the old correct but possibly slow algorithm. Since the old algorithm is just a special case of the new one (with a single block stretching the entire search range), you can configure the block size using `8EJ`. * Unfortunately, the new block-wise algorithm won't work due to a bug in GRegex (only in the glib wrapper code). It is therefore disabled for the time being by default and will probably only be enabled once we switch to a new regexp engine. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5199
2026-04-17fixed test suite on OBS builds for Ubuntu 24.04Robin Haberkorn1-10/+7
* The GTK version logs additional warnings, so we cannot match verbatim against stderr. Instead we only look for a line beginning with `Warning:` or `Error:`. * We now also test info messages (`1^A`).
2026-04-14`^A` now accepts an optional integer to specify the message severityRobin Haberkorn1-0/+10
* I.e. you can now log warnings and errors from SciTECO code as well. * We do not need a version of ^A accepting code points, since this is supported by ^T already.
2026-03-10testsuite: added ^ES test caseRobin Haberkorn1-0/+6
In TECO-11 pattern matching constructs do not allow backtracking, while the PCREs currently generated do allow backtracking. This would be easy to fix, but there should also be constructs to re-enable the backtracking semantics. I left only a Known Bug test case for the time being.
2026-02-22`-$$` and `-^C` always return -1 now instead of passing down the prefix signRobin Haberkorn1-0/+4
2026-01-24`ER` updates ^S/^Y now as any other text insertionRobin Haberkorn1-0/+3
2026-01-18fixed auto-completion of Unicode file namesRobin Haberkorn1-0/+5
* teco_string_diff() could return a number of bytes in the middle of an Unicode sequence. It now also requires Unicode strings. * Added a missing Unicode-validity check when replacing command lines (`{` and `}`). teco_cmdline_insert() should really be refactored, though (FIXME). * Added test case
2026-01-09Haiku is officially supported again from now onRobin Haberkorn1-1/+1
* Turns out that it works perfectly with the default --enable-malloc-replacement as malloc() is replaced globally. * Added note to configure.ac that malloc() replacement may be useful on platforms without a global symbol namespace - you just have to link statically (--enable-static-executables) as well. This wasn't necessary on Haiku, though. * Only the test suite required a minor fix since Haiku doesn't support `ulimit`. * The Gtk interface is broken though on Haiku: You cannot type dead keys, Ctrl and AltGr combinations. Doesn't appear to be SciTECO-specific though. The libraries simply doesn't report modifiers. Appears to be a bug in Haiku's GTK 3 port, at least in their Beta5 branch. It can be reproduced with gtk-demo as well. * This opens the door for contributing a port into HaikuPorts. This will probably be Curses-only for the time being (see above).
2025-12-30fixup: disabled the --detach test case againRobin Haberkorn1-6/+6
It causes build failures on OBS for several Linux distributions. It generally works on Linux, so it's probably related to Xvfb.
2025-12-30fixup: wait for test.txt in detached SciTECO instance for up to 10 secondsRobin Haberkorn1-4/+2
Hopefully fixes the OBS build errors.
2025-12-30GTK: implemented --detach|-d option for detaching from controlling terminalRobin Haberkorn1-0/+9
This is useful to launch from a terminal without "blocking" this terminal. There are tools like nohup and daemonize (BSD) to do the same, but having it builtin is shorter to write.
2025-12-25fixed ^S/^Y for search-replacement commandsRobin Haberkorn1-0/+2
It was returning the range of the search, but not of the inserted text. Since the searched text is deleted, the range of the insertion is more useful. It's also what was documented and what DEC TECO does.
2025-11-09Revert "testsuite: disable testcases with Valgrind only when detecting the ↵Robin Haberkorn1-2/+2
fmsbw.de CI runner" This reverts commit 092f7d9919d9572219b7bf516933c37180e6f400. Turns out that the "Memory limiting" test cases won't even successfully run on my PC under Valgrind.
2025-10-07throw an error immediately after nEB if n != 0Robin Haberkorn1-0/+3
* When typing nEBfilename$ (n != 0) you would find out that the construct is invalid only after typing out the entire command. We now throw an error immediately, ie. only Escape or string termination will be expected in interactive mode. * In batch mode, nothing should have changed.
2025-09-24./configure --with-launcher=LAUNCHER can be used to run SciTECO with a ↵Robin Haberkorn1-1/+1
launcher command (e.g. wine or wine64) * This can be used for bootstrapping Windows binaries cross-compiled on FreeBSD or Linux without requiring a native build to be installed first. It will also allow running the test suite under Wine. While Linux allows registering Wine as the launcher via binfmt_misc, on FreeBSD we have no choice than to use --with-launcher. * Unfortunately, SciTECO cannot currently be properly built with versions running under Wine and the test suite also fails.
2025-09-22testsuite: disable testcases with Valgrind only when detecting the fmsbw.de ↵Robin Haberkorn1-2/+2
CI runner These testcases can still be run with --valgrind on my PC.
2025-09-21testsuite: disable test cases when running with --valgrindRobin Haberkorn1-0/+6
Should fix the freebsd14-sciteco CI job. On the other hand, these test cases do run through on my workstation, so we might want to disable them *only* when running via CI.
2025-08-31support <:O>: if a label is not found, continue execution after the go-to ↵Robin Haberkorn1-0/+1
statement * this is a SciTECO extension - it's not in TECO-11 * Allows for select-case-like constructs with default-clauses as in :Os.^EQa$ !* default *! !s.foo! !* ... *! !s.bar! !* ... *! * Consistent with nOlabel0,label1,...$ if <n> is out of range. Unfortunately this form of computed goto is not applicable when "selecting" by strings or non-consecutive integers. * In order to continue after the <:O> statement, we must keep the program counter along with the label we were looking for. At the end of the macro, the PC is restored instead of throwing an error. * Since that would be very inefficient in loops - where potentially all iterations would result in rescanning till the end of the macro - we now store a completed-flag in the goto table. If it is set while trying to :O to an unknown label, we can just continue execution.
2025-08-30the computed go-to command (O) is now 0-indexed and all invalid indexes and ↵Robin Haberkorn1-0/+8
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.
2025-08-09Win32: avoid any automatic LF to CRLF conversions when writing to stdoutRobin Haberkorn1-0/+4
* At least the MSVCRT does this by default, i.e. the translation mode of stdout is not _O_BINARY. * This broke piping through SciTECO with --stdin --stdout, as this relies on SciTECO's builtin EOL normalization. Instead, you would get DOS linebreaks on output even if the source stream contains only UNIX linebreaks. * It would also break binary filters. * It seems to be safe to print only LF also for regular stdio (help and error messages), so I simply disaply the stdout (and stdin and stderr) EOL translation globally. * Also fixes Troff warnings due to the .in preprocessor writing output with DOS linebreaks. * Added a test case. All future platforms shouldn't perform any unexpected EOL translations on output.
2025-08-06command-line arguments are no longer passed via the unnamed buffer, but via ↵Robin Haberkorn1-3/+12
special Q-registers ^Ax * The unnamed buffer is also used for reading from --stdin, so you couldn't practically combine --stdin with passing command-line arguments to macros. * The old approach of passing command-line arguments via lines in the unnamed buffer was flawed anyway as it wouldn't work with filenames containing LF. This is just a very ancient feature, written when there weren't even long Q-reg names in SciTECO. * You can now e.g. pipe into SciTECO and edit what was read interactively, e.g. `dmesg | sciteco -i`. You can practically use SciTECO as a pager. * htbl.tes is now a command-line filter (uses -qio). * grosciteco.tes reads Troff intermediate code from stdin, so we no longer need "*.intermediate" temporary files. * added a getopt.tes test case to the testsuite. * This change unfortunately breaks most macros accepting command-line arguments, even if they used getopt.tes. It also requires updating ~/.teco_ini - see fallback.teco_ini.
2025-08-03testsuite: use --quiet and test output of stdio commands more thoroughlyRobin Haberkorn1-27/+46
* All test suite commands are now invoked with --quiet. When having to check the stdout of the test runs, you now longer have to filter "Info:" lines out or include them in the expout. * Use expout to compare the outputs of the stdio commands instead of just counting the number of output lines. * The <EO> command check is simplified by doing the arithmetics in SciTECO. * test the --stdin and --stdout options as well
2025-08-02fixed serious bug with certain alternative string termination chars in ↵Robin Haberkorn1-0/+3
commands with multiple string arguments * When `@`-modifying a command with several string arguments and choosing `{` as the alternative string termination character, the parser would get totally confused. Any sequence of `{` would be ignored and only the first non-`{` would become the termination character. Consequently you also couldn't choose a new terminator after the closing `}`. So even a documented code example from sciteco(7) wouldn't work. The same was true when using $ (escape) or ^A as the alternative termination character. * We can now correctly parse e.g. `@FR{foo}{bar}` or `@FR$foo$bar$` (even though the latter one is quite pointless). * has probably been broken forever (has been broken even before v2.0). * Whitespace is now ignored in front of alternative termination characters as in TECO-64, so we can also write `@S /foo/` or even ``` @^Um { !* blabla *! } ``` I wanted to disallow whitespace termination characters, so the alternative would have been to throw an error. The new implementation at least adds some functionality. * Avoid redundancies when parsing no-op characters via teco_is_noop(). I assume that this is inlined and drawn into any jump-table what would be generated for the switch-statement in teco_state_start_input(). * Alternative termination characters are still case-folded, even if they are Unicode glyphs, so `@IЖfooж` would work and insert `foo`. This should perhaps be restricted to ANSI characters?
2025-08-01fixed the test suite on Mac OSRobin Haberkorn1-1/+1
`echo -n` is not POSIX and obviously not supported on Mac OS' standard shell.
2025-08-01implemented the ^W command for refreshing the screen in loops, for sleeping ↵Robin Haberkorn1-1/+1
and also the CTRL+L immediate editing command * ^W can be added to loops in order to view progress in interactive mode. It also sleeps for a given number of milliseconds (10ms by default). * In batch mode it is therefore the sleep command. * Since CTRL+W is an immediate editing command, you will usually type it Caret+W. ASCII 23 however will also be accepted. * While ^W only updates the screen, you can force a complete redraw by pressing CTRL+L. This is what most terminal applications use for redrawing. It will make it harder to insert ASCII 12, but this is seldom necessary since it is a form feed. ^L (ASCII 12 and the upcaret variant ) is still a whitespace character and therefore treated as a NOP. * DEC TECO had CTRL+W as the refresh immediate editing command. Video TECO uses <ET> as a regular command for refreshign in loops. I'd rather keep ET reserved as a potential terminal configuration command as in DEC TECO, though.
2025-07-31added -v/--version and <EO> commandRobin Haberkorn2-0/+8
* DEC TECO had an <EO> command. In contrast to DEC TECO's implementation, the value reported by <EO> encodes a major.minor.micro semantic version.
2025-07-31implemented ^H command for returning the current time since midnight: ↵Robin Haberkorn1-2/+2
partially replaces ^B * :^H and ::^H now return the timestamps, while ^B only returns the date. * Pressing CTRL+H will rubout, so you will usually write it in upcaret mode.
2025-07-31implemented ^T command: allows typing by code and getting characters from ↵Robin Haberkorn1-0/+7
stdin or the user * n:^T always prints bytes (cf. :^A) * ^T without arguments returns a codepoint or byte from stdin. In interactive mode, this currentply places a cursor in the message line and waits for a keypress.
2025-07-28=/==/===: fixed detection of execution from the end of the command-lineRobin Haberkorn1-0/+2
In particular, fixes the test case `3<255=>` which would print only one number in interactive mode.