mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
fix weird n-fold unescaping
This commit is contained in:
parent
9d3cfe1069
commit
02a5d1a00b
@ -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 \\ */
|
||||
static char *expand_escapes(const char *line, SERVER_REC *server,
|
||||
WI_ITEM_REC *item)
|
||||
{
|
||||
char *ptr, *ret;
|
||||
int chr;
|
||||
const char *prev;
|
||||
int chr;
|
||||
|
||||
prev = line;
|
||||
ret = ptr = g_malloc(strlen(line)+1);
|
||||
for (; *line != '\0'; 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"
|
||||
event to handle it (or actually the text before
|
||||
the newline..) */
|
||||
if (ret != ptr) {
|
||||
*ptr = '\0';
|
||||
signal_emit("send text", 3, ret, server, item);
|
||||
if (prev != line) {
|
||||
const char *prev_line = g_strndup(prev, (line - prev) - 1);
|
||||
event_text(prev_line, server, item);
|
||||
g_free((char *)prev_line);
|
||||
prev = line + 1;
|
||||
ptr = ret;
|
||||
}
|
||||
} else if (chr != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user