From b36ff2502ae3b0e18fa862a01fba9cc2c9067e31 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 4 Oct 2024 23:41:16 +0400 Subject: 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@). --- src/parser.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/parser.c') 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); -- cgit v1.2.3