From 566f6d24becc3626a43c02b750f50bbdc63ada87 Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Thu, 28 Jun 2007 22:50:58 +0000 Subject: Do not require that a line matches the input level to add it to the 'after' context, so that '/lastlog -hilight -after 10 foo' has the same semantic as '/lastlog -hilight -before 10 foo'. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4570 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/textbuffer.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/fe-text/textbuffer.c') diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c index d96f080a..76f07ac8 100644 --- a/src/fe-text/textbuffer.c +++ b/src/fe-text/textbuffer.c @@ -463,7 +463,7 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline, g_return_val_if_fail(buffer != NULL, NULL); g_return_val_if_fail(text != NULL, NULL); - if (regexp && *text != '\0') { + if (regexp) { #ifdef HAVE_REGEX_H int flags = REG_EXTENDED | REG_NOSUB | (case_sensitive ? 0 : REG_ICASE); @@ -480,19 +480,21 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline, line = startline != NULL ? startline : buffer->first_line; for (; line != NULL; line = line->next) { - if ((line->info.level & level) == 0 || - (line->info.level & nolevel) != 0) - continue; + line_matched = (line->info.level & level) != 0 && + (line->info.level & nolevel) == 0; if (*text == '\0') { /* no search word, everything matches */ - textbuffer_line_ref(line); - matches = g_list_append(matches, line); + if (line_matched) { + textbuffer_line_ref(line); + matches = g_list_append(matches, line); + } continue; } textbuffer_line2text(line, FALSE, str); + if (line_matched) line_matched = #ifdef HAVE_REGEX_H regexp ? regexec(&preg, str->str, 0, NULL, 0) == 0 : -- cgit v1.2.3