From d729474195913a37a4a5f32943d7b213654cf538 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 10 May 2000 12:38:00 +0000 Subject: /LAST didn't work when window's max. number of lines was full + a few cleanups. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@210 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-textwidget.c | 2 +- src/fe-text/gui-windows.c | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/fe-text') diff --git a/src/fe-text/gui-textwidget.c b/src/fe-text/gui-textwidget.c index a380322b..f72229c6 100644 --- a/src/fe-text/gui-textwidget.c +++ b/src/fe-text/gui-textwidget.c @@ -181,11 +181,11 @@ static void cmd_lastlog(const char *data) if (count == 0) count = -1; level = lastlog_parse_args(args, &flags); - startline = lastlog_window_startline(flags & LASTLOG_FLAG_NEW); if ((flags & LASTLOG_FLAG_NOHEADERS) == 0) printformat(NULL, NULL, MSGLEVEL_LASTLOG, IRCTXT_LASTLOG_START); + startline = lastlog_window_startline(flags & LASTLOG_FLAG_NEW); list = gui_window_find_text(active_win, text, startline, flags & LASTLOG_FLAG_REGEXP, flags & LASTLOG_FLAG_WORD); tmp = lastlog_find_startline(list, count, atoi(start), level); diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index df1ba8ec..60956cce 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -613,13 +613,10 @@ GList *gui_window_find_text(WINDOW_REC *window, gchar *text, GList *startline, i g_return_val_if_fail(window != NULL, NULL); g_return_val_if_fail(text != NULL, NULL); - text = g_strdup(text); g_strup(text); matches = NULL; size = 1024; str = g_malloc(1024); - if (regcomp(&preg, text, REG_EXTENDED|REG_NOSUB) != 0) { - g_free(text); + if (regcomp(&preg, text, REG_ICASE|REG_EXTENDED|REG_NOSUB) != 0) return 0; - } if (startline == NULL) startline = WINDOW_GUI(window)->lines; for (tmp = startline; tmp != NULL; tmp = tmp->next) @@ -656,9 +653,9 @@ GList *gui_window_find_text(WINDOW_REC *window, gchar *text, GList *startline, i } str[n] = '\0'; - if (regexp ? /*regexec(&preg, str, 0, NULL, 0) == 0*/regexp_match(str, text) : + if (regexp ? regexec(&preg, str, 0, NULL, 0) == 0 : fullword ? stristr_full(str, text) != NULL : - strstr(str, text) != NULL) { + stristr(str, text) != NULL) { /* matched */ matches = g_list_append(matches, rec); } @@ -666,7 +663,6 @@ GList *gui_window_find_text(WINDOW_REC *window, gchar *text, GList *startline, i regfree(&preg); if (str != NULL) g_free(str); - g_free(text); return matches; } -- cgit v1.2.3