diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-11-22 17:58:10 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-11-23 02:41:42 +0300 |
commit | 61b811f1a4febf493142003840e8b10c1aa7bf81 (patch) | |
tree | 20703fe7fe8c1dd978550af6b405e25920855bb2 /src | |
parent | a61a81ec33188e8e93ec02912c60053107ae0485 (diff) | |
download | sciteco-61b811f1a4febf493142003840e8b10c1aa7bf81.tar.gz |
string building: ^c (caret+c) does no longer expand to data garbage for non-control characters, but to the literal caret, followed by c
* For instance `^$` would insert two characters.
* The alternative would have been to throw an error.
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index 9477b9a..729fe42 100644 --- a/src/parser.c +++ b/src/parser.c @@ -461,6 +461,15 @@ teco_state_stringbuilding_ctl_input(teco_machine_stringbuilding_t *ctx, gunichar case 'W': return &teco_state_stringbuilding_upper; case 'E': return &teco_state_stringbuilding_ctle; default: + if (chr < '@' || chr > '_') { + /* + * If ^c wouldn't result in a control character, + * insert these characters verbatim. + */ + if (ctx->result) + teco_string_append_c(ctx->result, '^'); + break; + } chr = TECO_CTL_KEY(chr); } |