diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-04 12:49:29 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-09 18:22:21 +0200 |
commit | b31b88717172e22b49c0493185f603b8f84989ec (patch) | |
tree | 43850d7d04e721987b89c37c68f24e657b5cb9c6 /src/qreg.c | |
parent | b85edaa0021c06d63fee6d8904fc822815e8b933 (diff) | |
download | sciteco-b31b88717172e22b49c0493185f603b8f84989ec.tar.gz |
the ^EUq string building escape now respects the encoding (can insert bytes or codepoints) (refs #5)
* This is trickier than it sounds because there isn't one single place to consult.
It depends on the context.
If the string argument relates to buffer contents - as in <I>, <S>, <FR> etc. -
the buffer's encoding is consulted.
If it goes into a register (EU), the register's encoding is consulted.
Everything else (O, EN, EC, ES...) expects only Unicode codepoints.
* This is communicated through a new field teco_machine_stringbuilding_t::codepage
which must be set in the states' initial callback.
* Seems overkill just for ^EUq, but it can be used for context-sensitive
processing of all the other string building constructs as well.
* ^V and ^W cannot be supported for Unicode characters for the time being without an Unicode-aware parser
Diffstat (limited to 'src/qreg.c')
-rw-r--r-- | src/qreg.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -204,14 +204,14 @@ teco_qreg_plain_get_integer(teco_qreg_t *qreg, teco_int_t *ret, GError **error) return TRUE; } -static gint +static guint teco_qreg_plain_get_codepage(teco_qreg_t *qreg) { if (teco_qreg_current) teco_doc_update(&teco_qreg_current->string, teco_qreg_view); teco_doc_edit(&qreg->string); - gint ret = teco_view_ssm(teco_qreg_view, SCI_GETCODEPAGE, 0, 0); + guint ret = teco_view_get_codepage(teco_qreg_view); if (teco_qreg_current) teco_doc_edit(&teco_qreg_current->string); @@ -408,7 +408,7 @@ teco_qreg_external_edit(teco_qreg_t *qreg, GError **error) return TRUE; } -static gint +static guint teco_qreg_external_get_codepage(teco_qreg_t *qreg) { /* |