diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-06-01 02:38:25 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-06-01 03:06:13 +0300 |
commit | 442268285a5f8b1d53052b6c7b0566d9200e71c7 (patch) | |
tree | 90fb62e9157445aebc2253ece0ec96b0934d1932 /src/qreg-commands.c | |
parent | 6e3da17a2fae11af9ae00d9b59bd0d752022e16b (diff) | |
download | sciteco-442268285a5f8b1d53052b6c7b0566d9200e71c7.tar.gz |
<nA> and <nQq> now return -1 in case the index n is out of range
* The old behavior of throwing an error was inherited from Video TECO.
* The command is now more similar to TECO-11.
* Since -1 is taken, invalid and incomplete UTF-8 byte sequences
are now reported as -2/-3.
I wasn't really able to provoke -3, though.
Diffstat (limited to 'src/qreg-commands.c')
-rw-r--r-- | src/qreg-commands.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qreg-commands.c b/src/qreg-commands.c index 51f9149..a3caad0 100644 --- a/src/qreg-commands.c +++ b/src/qreg-commands.c @@ -300,21 +300,21 @@ teco_state_queryqreg_got_register(teco_machine_main_t *ctx, teco_qreg_t *qreg, /*$ Q Qq query * Qq -> n -- Query Q-Register existence, its integer or string characters * -Qq -> -n - * <position>Qq -> character + * <position>Qq -> code * :Qq -> -1 | size * * Without any arguments, get and return the integer-part of * Q-Register <q>. * - * With one argument, return the <character> code at <position> + * With one argument, return the character <code> at <position> * from the string-part of Q-Register <q>. * Positions are handled like buffer positions \(em they * begin at 0 up to the length of the string minus 1. - * An error is thrown for invalid positions. + * -1 is returned for invalid positions. * If <q> is encoded as UTF-8 and there is - * an incomplete sequence at the requested position, - * -1 is returned. - * All other invalid Unicode sequences are returned as -2. + * an invalid byte sequence at the requested position, + * -2 is returned. + * Incomplete UTF-8 byte sequences are returned as -3. * Both non-colon-modified forms of Q require register <q> * to be defined and fail otherwise. * |