summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2007-06-28 22:50:58 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-06-28 22:50:58 +0000
commit566f6d24becc3626a43c02b750f50bbdc63ada87 (patch)
treec32d0cb170c0694d111c2dfa17ba4905c5ed1bb6 /src
parentbc45b39030154e059fc7b53a237c90f421130854 (diff)
downloadirssi-566f6d24becc3626a43c02b750f50bbdc63ada87.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/textbuffer.c14
1 files changed, 8 insertions, 6 deletions
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 :