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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index ef4621f..a84d0ef 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -2494,8 +2494,7 @@ teco_state_ecommand_encoding(teco_machine_main_t *ctx, GError **error)
gboolean colon_modified = teco_machine_main_eval_colon(ctx);
- sptr_t old_cp = teco_interface_ssm(SCI_GETCODEPAGE, 0, 0)
- ? : teco_interface_ssm(SCI_STYLEGETCHARACTERSET, STYLE_DEFAULT, 0);
+ guint old_cp = teco_interface_get_codepage();
if (!teco_expressions_args()) {
/* get current code page */
@@ -2745,6 +2744,12 @@ teco_state_insert_initial(teco_machine_main_t *ctx, GError **error)
if (ctx->mode > TECO_MODE_NORMAL)
return TRUE;
+ /*
+ * Current document's encoding determines the behaviour of
+ * string building constructs.
+ */
+ teco_undo_guint(ctx->expectstring.machine.codepage) = teco_interface_get_codepage();
+
if (!teco_expressions_eval(FALSE, error))
return FALSE;
guint args = teco_expressions_args();