aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/spawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/spawn.c')
-rw-r--r--src/spawn.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/spawn.c b/src/spawn.c
index 445acc5..cb1ef75 100644
--- a/src/spawn.c
+++ b/src/spawn.c
@@ -43,6 +43,7 @@
#include "core-commands.h"
#include "qreg-commands.h"
#include "error.h"
+#include "cmdline.h"
#include "spawn.h"
/*
@@ -167,8 +168,12 @@ teco_state_execute_initial(teco_machine_main_t *ctx, GError **error)
/*
* Command-lines and file names are always assumed to be UTF-8,
* unless we set TECO_ED_DEFAULT_ANSI.
+ *
+ * NOTE: This is not safe to undo in macro calls.
*/
- teco_undo_guint(ctx->expectstring.machine.codepage) = teco_default_codepage();
+ if (ctx == &teco_cmdline.machine)
+ teco_undo_guint(ctx->expectstring.machine.codepage);
+ ctx->expectstring.machine.codepage = teco_default_codepage();
if (!teco_expressions_eval(FALSE, error))
return FALSE;