diff options
Diffstat (limited to 'src/parser.c')
-rw-r--r-- | src/parser.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/parser.c b/src/parser.c index 8cb26e7..4e42833 100644 --- a/src/parser.c +++ b/src/parser.c @@ -35,6 +35,7 @@ #include "ring.h" #include "glob.h" #include "error.h" +#include "cmdline.h" #include "core-commands.h" #include "goto-commands.h" #include "parser.h" @@ -906,8 +907,15 @@ 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) - teco_undo_guint(ctx->expectstring.machine.codepage) = teco_default_codepage(); + 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(); return TRUE; } |