aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-10-04 23:41:16 +0400
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-10-04 23:41:16 +0400
commitb36ff2502ae3b0e18fa862a01fba9cc2c9067e31 (patch)
treee4ffef55d060b77706b65ca48c6c0ae62a57e89e /src/parser.c
parent024d26ac0cd869826801889f1299df34676fdf57 (diff)
downloadsciteco-b36ff2502ae3b0e18fa862a01fba9cc2c9067e31.tar.gz
pattern match characters support ^Q/^R now as well
* makes it possible, albeit cumbersome, to escape pattern match characters * For instance, to search for ^Q, you now have to type S^Q^Q^Q^Q$. To search for ^E you have to type S^Q^Q^Q^E$. But the last character cannot be typed with carets currently (FIXME?). For pattern-only characters, two ^Q should be sufficient as in S^Q^Q^X$. * Perhaps it would be more elegant to abolish the difference between string building and pattern matching characters to avoid double quoting. But then all string building constructs like ^EQq should operate at the pattern level as well (ie. match the contents of register q verbatim instead of being interpreted as a pattern). TECOC and TECO-64 don't do that either. If we leave everything as it is, at least a new string building construct should be added for auto-quoting patterns (analoguous to ^EN and ^E@).
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c
index 7ba9876..8cb26e7 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -603,6 +603,7 @@ teco_state_stringbuilding_ctle_input(teco_machine_stringbuilding_t *ctx, gunicha
case 'N': next = &teco_state_stringbuilding_ctle_n; break;
default:
if (ctx->result) {
+ /* also makes sure that search patterns can start with ^E */
gchar buf[1+6] = {TECO_CTL_KEY('E')};
gsize len = g_unichar_to_utf8(chr, buf+1);
teco_machine_stringbuilding_append(ctx, buf, 1+len);