From 442268285a5f8b1d53052b6c7b0566d9200e71c7 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 1 Jun 2025 02:38:25 +0300 Subject: and 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. --- src/qreg-commands.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qreg-commands.c') 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 - * Qq -> character + * Qq -> code * :Qq -> -1 | size * * Without any arguments, get and return the integer-part of * Q-Register . * - * With one argument, return the code at + * With one argument, return the character at * from the string-part of Q-Register . * 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 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 * to be defined and fail otherwise. * -- cgit v1.2.3