mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #978 from ailin-nemui/fix-974
Fix inconsistent escaping from expand_escapes
This commit is contained in:
commit
d57203e926
@ -757,6 +757,22 @@ char *escape_string(const char *str)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Escape all '\' chars with '\' */
|
||||||
|
char *escape_string_backslashes(const char *str)
|
||||||
|
{
|
||||||
|
char *ret, *p;
|
||||||
|
|
||||||
|
p = ret = g_malloc(strlen(str)*2+1);
|
||||||
|
while (*str != '\0') {
|
||||||
|
if (*str == '\\')
|
||||||
|
*p++ = '\\';
|
||||||
|
*p++ = *str++;
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int nearest_power(int num)
|
int nearest_power(int num)
|
||||||
{
|
{
|
||||||
int n = 1;
|
int n = 1;
|
||||||
|
@ -93,6 +93,9 @@ char *ascii_strdown(char *str);
|
|||||||
/* Escape all '"', "'" and '\' chars with '\' */
|
/* Escape all '"', "'" and '\' chars with '\' */
|
||||||
char *escape_string(const char *str);
|
char *escape_string(const char *str);
|
||||||
|
|
||||||
|
/* Escape all '\' chars with '\' */
|
||||||
|
char *escape_string_backslashes(const char *str);
|
||||||
|
|
||||||
/* convert all low-ascii (<32) to ^<A..> combinations */
|
/* convert all low-ascii (<32) to ^<A..> combinations */
|
||||||
char *show_lowascii(const char *str);
|
char *show_lowascii(const char *str);
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
|
|||||||
|
|
||||||
/* escape if the word doesn't begin with '/' and expand_escapes are turned on */
|
/* escape if the word doesn't begin with '/' and expand_escapes are turned on */
|
||||||
data = strchr(cmdchars, *line) == NULL && expand_escapes ?
|
data = strchr(cmdchars, *line) == NULL && expand_escapes ?
|
||||||
escape_string(complist->data) : g_strdup(complist->data);
|
escape_string_backslashes(complist->data) : g_strdup(complist->data);
|
||||||
|
|
||||||
/* word completed */
|
/* word completed */
|
||||||
*pos = startpos + strlen(data);
|
*pos = startpos + strlen(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user