aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core-commands.c')
-rw-r--r--src/core-commands.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index a390fa4..befb6e8 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -2759,8 +2759,12 @@ 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.
*/
- teco_undo_guint(ctx->expectstring.machine.codepage) = teco_interface_get_codepage();
+ if (ctx == &teco_cmdline.machine)
+ teco_undo_guint(ctx->expectstring.machine.codepage);
+ ctx->expectstring.machine.codepage = teco_interface_get_codepage();
if (!teco_expressions_eval(FALSE, error))
return FALSE;