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/parser.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 4e42833..b1aa06e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -35,7 +35,6 @@ #include "ring.h" #include "glob.h" #include "error.h" -#include "cmdline.h" #include "core-commands.h" #include "goto-commands.h" #include "parser.h" @@ -907,15 +906,9 @@ teco_machine_stringbuilding_clear(teco_machine_stringbuilding_t *ctx) gboolean teco_state_expectstring_initial(teco_machine_main_t *ctx, GError **error) { - if (ctx->mode > TECO_MODE_NORMAL) - return TRUE; - - /* - * 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_default_codepage(); + if (ctx->mode == TECO_MODE_NORMAL) + teco_machine_stringbuilding_set_codepage(&ctx->expectstring.machine, + teco_default_codepage()); return TRUE; } -- cgit v1.2.3