aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core-commands.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-22 17:47:51 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-23 02:41:42 +0300
commita61a81ec33188e8e93ec02912c60053107ae0485 (patch)
treea67fd9d37f434f1c169a05b2d6088a68fe34a798 /src/core-commands.c
parent1cfe37610253c20a4fcb0d937c29e70894ecc4f5 (diff)
downloadsciteco-a61a81ec33188e8e93ec02912c60053107ae0485.tar.gz
disallow setting the radix to values lower than 2
* This would actually causes crashes when trying to format numbers. * The ^R local register has a custom set_integer() method now, so that the check is performed also when using nU.^X.
Diffstat (limited to 'src/core-commands.c')
-rw-r--r--src/core-commands.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index ba7aaa8..fa2f8b5 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -1741,7 +1741,7 @@ teco_state_control_decimal(teco_machine_main_t *ctx, GError **error)
* radix^R -- Set and get radix
* ^R -> radix
*
- * Set current radix to arbitrary value <radix>.
+ * Set current radix to any value <radix> larger than or equal to 2.
* If <radix> is omitted, the command instead
* returns the current radix.
*
@@ -1764,11 +1764,6 @@ teco_state_control_radix(teco_machine_main_t *ctx, GError **error)
return;
teco_expressions_push(radix);
} else {
- /*
- * FIXME: We should restrict the allowed values.
- * 0^R 23\ crashes for instance.
- * The ^R register should consequently also be "special".
- */
if (!teco_expressions_pop_num_calc(&radix, 0, error) ||
!qreg->vtable->undo_set_integer(qreg, error) ||
!qreg->vtable->set_integer(qreg, radix, error))