aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-07-26 13:47:17 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-07-26 13:47:17 +0200
commitcca906658aee1dcaa38787880c54fe304f9f2e94 (patch)
tree69fc4eb8f3a23db80192c15ff5023e9363600a95 /src
parent68364bd3637b6944fa1f63a00dae5caf375afab9 (diff)
`A` without arguments is now equivalent to `0A`
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/core-commands.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index 32381f7..6c4ab58 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -621,7 +621,8 @@ teco_state_start_cmdline_pop(teco_machine_main_t *ctx, GError **error)
* immediately after dot.
* - If <n> is -1, return the <code> of the character
* immediately preceding dot, ecetera.
- * - If <n> is omitted, the sign prefix is implied.
+ * - If <n> is omitted, 0 is implied.
+ * However \(lq-A\(rq is equivalent to \(lq-1A\(rq.
*
* If the position of the queried character is off-page,
* the command will return -1.
@@ -630,11 +631,19 @@ teco_state_start_cmdline_pop(teco_machine_main_t *ctx, GError **error)
* -2 is returned.
* Incomplete byte sequences are returned as -3.
*/
+/*
+ * NOTE: `A` without arguments is the Append I/O
+ * command in TECO-11. It doesn't make sense in our case.
+ */
static void
teco_state_start_get(teco_machine_main_t *ctx, GError **error)
{
- teco_int_t v;
- if (!teco_expressions_pop_num_calc(&v, teco_num_sign, error))
+ teco_int_t v = 0;
+
+ if (!teco_expressions_eval(FALSE, error))
+ return;
+ if ((teco_expressions_args() || teco_num_sign < 0) &&
+ !teco_expressions_pop_num_calc(&v, teco_num_sign, error))
return;
gssize get_pos = teco_interface_glyphs2bytes_reldot(v);