aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cmdline.c
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-08-09 13:52:37 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-08-10 23:55:40 +0200
commit822b93aa765c7497b617ead419357f1be09e9ab0 (patch)
tree40bd544ed57f27dc597735a89a1049417a2170ef /src/cmdline.c
parent573c9d9b60e2c4dca2be6ccd43ac92b8725f4453 (diff)
when inserting text after auto completions, escape all magic string building characters
This fixes insertion of strings containing ^, ^P, ^Q, ^R, ^V, ^W, ^E. It mainly affects Q-Register specification auto-completions, but filenames could theoretically also contain such special characters.
Diffstat (limited to 'src/cmdline.c')
-rw-r--r--src/cmdline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmdline.c b/src/cmdline.c
index e7761aa..7fe044c 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -1475,6 +1475,9 @@ teco_state_help_process_edit_cmd(teco_machine_main_t *ctx, teco_machine_t *paren
g_auto(teco_string_t) new_chars, new_chars_escaped;
gboolean unambiguous = teco_help_auto_complete(ctx->expectstring.string.data, &new_chars);
+ /*
+ * FIXME: The help command (?) does not have string building characters.
+ */
teco_machine_stringbuilding_escape(stringbuilding_ctx, new_chars.data, new_chars.len, &new_chars_escaped);
if (unambiguous && ctx->expectstring.nesting == 1)
teco_string_append_wc(&new_chars_escaped,
@@ -1492,6 +1495,9 @@ teco_state_help_insert_completion(teco_machine_main_t *ctx, teco_string_t str, G
{
teco_machine_stringbuilding_t *stringbuilding_ctx = &ctx->expectstring.machine;
+ /*
+ * FIXME: The help command (?) does not have string building characters.
+ */
g_auto(teco_string_t) str_escaped;
teco_machine_stringbuilding_escape(stringbuilding_ctx, str.data, str.len, &str_escaped);
if (ctx->expectstring.nesting == 1)