summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-10-20 10:03:57 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-10-20 10:03:57 +0200
commit00dbaf7e64645e29fa5426e3160ecdb2de555975 (patch)
tree98727be55542d0834ee27883bbc1f46fa4be1530 /src/gui
parentac3c91937688a776dd93749f2652fb1e2fe2e314 (diff)
downloadweechat-00dbaf7e64645e29fa5426e3160ecdb2de555975.zip
Fix text search in buffer: search with prefix in addition to the message
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-chat.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 9d7e8bc84..1a0e7cf30 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -495,21 +495,38 @@ int
gui_chat_line_search (struct t_gui_line *line, const char *text,
int case_sensitive)
{
- char *message;
+ char *prefix, *message;
int rc;
if (!line || !line->message || !text || !text[0])
return 0;
rc = 0;
- message = (char *)gui_color_decode ((unsigned char *)line->message);
- if (message)
+
+ if (line->prefix)
{
- if ((case_sensitive && (strstr (message, text)))
- || (!case_sensitive && (string_strcasestr (message, text))))
- rc = 1;
- free (message);
+ prefix = (char *)gui_color_decode ((unsigned char *)line->prefix);
+ if (prefix)
+ {
+ if ((case_sensitive && (strstr (prefix, text)))
+ || (!case_sensitive && (string_strcasestr (prefix, text))))
+ rc = 1;
+ free (prefix);
+ }
}
+
+ if (!rc)
+ {
+ message = (char *)gui_color_decode ((unsigned char *)line->message);
+ if (message)
+ {
+ if ((case_sensitive && (strstr (message, text)))
+ || (!case_sensitive && (string_strcasestr (message, text))))
+ rc = 1;
+ free (message);
+ }
+ }
+
return rc;
}