mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #723 from ailin-nemui/odd_expand_escapes
fix weird n-fold unescaping in expand_escapes
This commit is contained in:
commit
1ff2f61f09
@ -1011,13 +1011,17 @@ static void sig_complete_target(GList **list, WINDOW_REC *window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_text(const char *data, SERVER_REC *server, WI_ITEM_REC *item);
|
||||||
|
|
||||||
/* expand \n, \t and \\ */
|
/* expand \n, \t and \\ */
|
||||||
static char *expand_escapes(const char *line, SERVER_REC *server,
|
static char *expand_escapes(const char *line, SERVER_REC *server,
|
||||||
WI_ITEM_REC *item)
|
WI_ITEM_REC *item)
|
||||||
{
|
{
|
||||||
char *ptr, *ret;
|
char *ptr, *ret;
|
||||||
|
const char *prev;
|
||||||
int chr;
|
int chr;
|
||||||
|
|
||||||
|
prev = line;
|
||||||
ret = ptr = g_malloc(strlen(line)+1);
|
ret = ptr = g_malloc(strlen(line)+1);
|
||||||
for (; *line != '\0'; line++) {
|
for (; *line != '\0'; line++) {
|
||||||
if (*line != '\\') {
|
if (*line != '\\') {
|
||||||
@ -1036,9 +1040,11 @@ static char *expand_escapes(const char *line, SERVER_REC *server,
|
|||||||
/* newline .. we need to send another "send text"
|
/* newline .. we need to send another "send text"
|
||||||
event to handle it (or actually the text before
|
event to handle it (or actually the text before
|
||||||
the newline..) */
|
the newline..) */
|
||||||
if (ret != ptr) {
|
if (prev != line) {
|
||||||
*ptr = '\0';
|
char *prev_line = g_strndup(prev, (line - prev) - 1);
|
||||||
signal_emit("send text", 3, ret, server, item);
|
event_text(prev_line, server, item);
|
||||||
|
g_free(prev_line);
|
||||||
|
prev = line + 1;
|
||||||
ptr = ret;
|
ptr = ret;
|
||||||
}
|
}
|
||||||
} else if (chr != -1) {
|
} else if (chr != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user