From 41ab5cf0289dab60ac1ddc97cf9680ee2468ea6c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 9 Sep 2024 00:03:33 +0200 Subject: Xq and ]q inherit the document encoding from the source document (refs #5) * ^Uq however always sets an UTF8 register as the source is supposed to be a SciTECO macro which is always UTF-8. * :^Uq preserves the register's encoding * teco_doc_set_string() now also sets the encoding * instead of trying to restore the encoding in teco_doc_undo_set_string(), we now swap out the document in a teco_doc_t and pass it to an undo token. * The get_codepage() Q-Reg method has been removed as the same can now be done with teco_doc_get_string() and the get_string() method. --- src/core-commands.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/core-commands.c') diff --git a/src/core-commands.c b/src/core-commands.c index a84d0ef..638279d 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -1451,7 +1451,7 @@ teco_state_changedir_done(teco_machine_main_t *ctx, const teco_string_t *str, GE teco_qreg_t *qreg = teco_qreg_table_find(&teco_qreg_table_globals, "$HOME", 5); g_assert(qreg != NULL); teco_string_t home; - if (!qreg->vtable->get_string(qreg, &home.data, &home.len, error)) + if (!qreg->vtable->get_string(qreg, &home.data, &home.len, NULL, error)) return NULL; /* @@ -2634,8 +2634,6 @@ teco_state_ecommand_encoding(teco_machine_main_t *ctx, GError **error) * Only now, it will be safe to recalculate dot in the new encoding. * If the new codepage is UTF-8, the line character index will be * ready only now. - * FIXME: Apparently the line character index is still not ready - * after switching to UTF-8! */ teco_interface_ssm(SCI_GOTOPOS, teco_glyphs2bytes(dot_glyphs), 0); } -- cgit v1.2.3