diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-16 11:40:52 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-16 11:40:52 +0300 |
commit | d714bb48a4b8629f6345a28bc21a24537207176b (patch) | |
tree | d605b57c182741590377edae8ced7e693000523d /src/qreg-commands.c | |
parent | d556aee67e615b48c25861741d28d103109235e3 (diff) | |
download | sciteco-d714bb48a4b8629f6345a28bc21a24537207176b.tar.gz |
fixup: use teco_machine_t::must_undo instead of trying to identify the current state machine
* The previous solution was not wrong, but unnecessarily complex. We already have a flag
for exactly this purpose.
* Avoid redundancies by introducing teco_machine_stringbuilding_set_codepage().
Diffstat (limited to 'src/qreg-commands.c')
-rw-r--r-- | src/qreg-commands.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/qreg-commands.c b/src/qreg-commands.c index f8bb4cb..cff4c84 100644 --- a/src/qreg-commands.c +++ b/src/qreg-commands.c @@ -29,7 +29,6 @@ #include "interface.h" #include "ring.h" #include "parser.h" -#include "cmdline.h" #include "core-commands.h" #include "qreg.h" #include "qreg-commands.h" @@ -493,12 +492,12 @@ teco_state_setqregstring_building_initial(teco_machine_main_t *ctx, GError **err /* * The expected codepage of string building constructs is determined * by the Q-Register. - * - * NOTE: This is not safe to undo in macro calls. */ - if (ctx == &teco_cmdline.machine) - teco_undo_guint(ctx->expectstring.machine.codepage); - return qreg->vtable->get_string(qreg, NULL, NULL, &ctx->expectstring.machine.codepage, error); + guint codepage; + if (!qreg->vtable->get_string(qreg, NULL, NULL, &codepage, error)) + return FALSE; + teco_machine_stringbuilding_set_codepage(&ctx->expectstring.machine, codepage); + return TRUE; } static teco_state_t * |