diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-02 23:29:09 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-09 18:22:21 +0200 |
commit | a747cff2b6027d5e013aa84c1db0159c51983a79 (patch) | |
tree | 6868c2f03df801b25c12851ccc6c5e51c496bbd8 | |
parent | 4dadac8a15b5fa17679db9ef64b437919399f226 (diff) | |
download | sciteco-a747cff2b6027d5e013aa84c1db0159c51983a79.tar.gz |
conditionals now check for Unicode codepoints (refs #5)
* This will naturally work with both ASCII characters and various
non-English scripts.
* Unfortunately, it cannot work with the other non-ANSI single-byte codepages.
* If we'd like to support scripts working with all sorts of codepoints,
we'd have to introduce a new command for translating individual codepoints
from the current codepage (as reported by EE) to Unicode.
-rw-r--r-- | doc/sciteco.7.template | 12 | ||||
-rw-r--r-- | src/core-commands.c | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 4d4ed55..a6cca40 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -2066,17 +2066,17 @@ For instance the following macro inserts \fIn\fP tab characters .TP .SCITECO_TOPIC """A" .IB n \(dqA -Applies if \fIn\fP is the code of an alphabetic character. +Applies if \fIn\fP is the Unicode codepoint of an alphabetic character. .TP .SCITECO_TOPIC """C" .IB n \(dqC -Applies if \fIn\fP is the code of a symbol constituent. +Applies if \fIn\fP is the Unicode codepoint of a symbol constituent. Like in pattern matching, a symbol constituent is defined as an alpha-numeric character, dot, dollar or underscore. .TP .SCITECO_TOPIC """D" .IB n \(dqD -Applies if \fIn\fP is the code of a digit character (0 to 9). +Applies if \fIn\fP is the Unicode codepoint of a digit character. The current radix is insignificant. .TP .SCITECO_TOPIC """I" @@ -2149,16 +2149,16 @@ will commonly write: .TP .SCITECO_TOPIC """R" .IB n \(dqR -Applies if \fIn\fP is the code of an alpha-numeric character. +Applies if \fIn\fP is the Unicode codepoint of an alpha-numeric character. .TP .SCITECO_TOPIC """V" .IB n \(dqV -Applies if \fIn\fP is the code of a lower-case alphabetic +Applies if \fIn\fP is the Unicode codepoint of a lower-case alphabetic character. .TP .SCITECO_TOPIC """W" .IB n \(dqW -Applies if \fIn\fP is the code of a upper-case alphabetic +Applies if \fIn\fP is the Unicode codepoint of an upper-case alphabetic character. .LP There are also a number of flow-control commands like diff --git a/src/core-commands.c b/src/core-commands.c index edd7e35..1d060b0 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -1552,20 +1552,20 @@ teco_state_condcommand_input(teco_machine_main_t *ctx, gchar chr, GError **error break; case 'A': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_isalpha((gchar)value); + result = g_unichar_isalpha(value); break; case 'C': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_isalnum((gchar)value) || + result = g_unichar_isalnum(value) || value == '.' || value == '$' || value == '_'; break; case 'D': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_isdigit((gchar)value); + result = g_unichar_isdigit(value); break; case 'I': if (ctx->mode == TECO_MODE_NORMAL) - result = G_IS_DIR_SEPARATOR((gchar)value); + result = G_IS_DIR_SEPARATOR(value); break; case 'S': case 'T': @@ -1598,15 +1598,15 @@ teco_state_condcommand_input(teco_machine_main_t *ctx, gchar chr, GError **error break; case 'R': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_isalnum((gchar)value); + result = g_unichar_isalnum(value); break; case 'V': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_islower((gchar)value); + result = g_unichar_islower(value); break; case 'W': if (ctx->mode == TECO_MODE_NORMAL) - result = g_ascii_isupper((gchar)value); + result = g_unichar_isupper(value); break; default: g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED, |