From d714bb48a4b8629f6345a28bc21a24537207176b Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 16 Oct 2024 11:40:52 +0300 Subject: 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(). --- src/core-commands.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/core-commands.c') diff --git a/src/core-commands.c b/src/core-commands.c index befb6e8..0cde7e0 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -2759,12 +2759,9 @@ teco_state_insert_initial(teco_machine_main_t *ctx, GError **error) /* * Current document's encoding determines the behaviour of * string building constructs. - * - * NOTE: This is not safe to undo in macro calls. */ - if (ctx == &teco_cmdline.machine) - teco_undo_guint(ctx->expectstring.machine.codepage); - ctx->expectstring.machine.codepage = teco_interface_get_codepage(); + teco_machine_stringbuilding_set_codepage(&ctx->expectstring.machine, + teco_interface_get_codepage()); if (!teco_expressions_eval(FALSE, error)) return FALSE; -- cgit v1.2.3