fix: ensure consistent unescaping and space handling

Unescape any character following a backslash. This fixes autocompletion
for names with escaped spaces.
For example: `/msg Thor\ Odinson hello`

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
Michael Vetter
2026-03-30 18:33:59 +02:00
parent bda5b0f844
commit df1f1e5ef1
8 changed files with 92 additions and 2 deletions

View File

@@ -237,7 +237,7 @@ autocomplete_complete(Autocomplete ac, const gchar* search_str, gboolean quote,
// unescape search string
GString* unescaped = g_string_new("");
for (const char* p = search_str; *p; p++) {
if (*p == '\\' && (*(p + 1) == '"' || *(p + 1) == '\\')) {
if (*p == '\\' && (*(p + 1) != '\0')) {
p++;
}
g_string_append_c(unescaped, *p);