mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 20:00:23 +02:00
Merge branch 'master' into 'security'
Sync to master See merge request !6
This commit is contained in:
commit
7a112e0217
19 changed files with 349 additions and 117 deletions
|
|
@ -194,6 +194,8 @@ static void statusbar_read_group(CONFIG_NODE *node)
|
|||
STATUSBAR_GROUP_REC *group;
|
||||
GSList *tmp;
|
||||
|
||||
g_return_if_fail(is_node_list(node));
|
||||
|
||||
group = statusbar_group_find(node->key);
|
||||
if (group == NULL) {
|
||||
group = statusbar_group_create(node->key);
|
||||
|
|
|
|||
|
|
@ -143,16 +143,34 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
|
|||
static void item_act(SBAR_ITEM_REC *item, int get_size_only)
|
||||
{
|
||||
char *actlist;
|
||||
int max_size;
|
||||
|
||||
actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE);
|
||||
if (actlist == NULL) {
|
||||
if (get_size_only)
|
||||
if (get_size_only) {
|
||||
if (activity_list == NULL)
|
||||
item->min_size = item->max_size = 0;
|
||||
/* Skip activity calculation on regular trigger, only
|
||||
set dirty */
|
||||
return;
|
||||
}
|
||||
|
||||
statusbar_item_default_handler(item, get_size_only,
|
||||
actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE);
|
||||
if (actlist == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
max_size = item->max_size;
|
||||
statusbar_item_default_handler(item, TRUE,
|
||||
NULL, actlist, FALSE);
|
||||
statusbar_item_default_handler(item, FALSE,
|
||||
NULL, actlist, FALSE);
|
||||
if (max_size != item->max_size) {
|
||||
/* Due to above hack of skipping the calculation, we
|
||||
need to manually trigger the redraw process now or
|
||||
we won't see the item */
|
||||
item->bar->dirty = item->dirty = TRUE;
|
||||
statusbar_redraw(item->bar, TRUE);
|
||||
statusbar_redraw_dirty();
|
||||
}
|
||||
|
||||
g_free_not_null(actlist);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "textbuffer.h"
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifndef USE_GREGEX
|
||||
# include <regex.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -537,7 +537,9 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
|||
int before, int after,
|
||||
int regexp, int fullword, int case_sensitive)
|
||||
{
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef USE_GREGEX
|
||||
GRegex *preg;
|
||||
#else
|
||||
regex_t preg;
|
||||
#endif
|
||||
LINE_REC *line, *pre_line;
|
||||
|
|
@ -549,16 +551,23 @@ 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);
|
||||
|
||||
#ifdef USE_GREGEX
|
||||
preg = NULL;
|
||||
|
||||
if (regexp) {
|
||||
preg = g_regex_new(text, G_REGEX_RAW | (case_sensitive ? 0 : G_REGEX_CASELESS), 0, NULL);
|
||||
|
||||
if (preg == NULL)
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
if (regexp) {
|
||||
#ifdef HAVE_REGEX_H
|
||||
int flags = REG_EXTENDED | REG_NOSUB |
|
||||
(case_sensitive ? 0 : REG_ICASE);
|
||||
if (regcomp(&preg, text, flags) != 0)
|
||||
return NULL;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
matches = NULL; match_after = 0;
|
||||
str = g_string_new(NULL);
|
||||
|
|
@ -577,12 +586,15 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
|||
if (*text != '\0') {
|
||||
textbuffer_line2text(line, FALSE, str);
|
||||
|
||||
if (line_matched)
|
||||
line_matched =
|
||||
#ifdef HAVE_REGEX_H
|
||||
regexp ? regexec(&preg, str->str, 0, NULL, 0) == 0 :
|
||||
if (line_matched) {
|
||||
line_matched = regexp ?
|
||||
#ifdef USE_GREGEX
|
||||
g_regex_match(preg, str->str, 0, NULL)
|
||||
#else
|
||||
regexec(&preg, str->str, 0, NULL, 0) == 0
|
||||
#endif
|
||||
match_func(str->str, text) != NULL;
|
||||
: match_func(str->str, text) != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (line_matched) {
|
||||
|
|
@ -610,7 +622,11 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
|||
matches = g_list_append(matches, NULL);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
||||
#ifdef USE_GREGEX
|
||||
if (preg != NULL)
|
||||
g_regex_unref(preg);
|
||||
#else
|
||||
if (regexp) regfree(&preg);
|
||||
#endif
|
||||
g_string_free(str, TRUE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue