Merge branch '3813_filter_clear'

* 3813_filter_clear:
  Ticket #3813: Filter isn't cleared when entering empty string.
This commit is contained in:
Mooffie 2017-04-23 10:06:09 +03:00
commit e4983a18e8
2 changed files with 8 additions and 6 deletions

View File

@ -174,12 +174,15 @@ static void
set_panel_filter_to (WPanel * p, char *allocated_filter_string)
{
g_free (p->filter);
p->filter = 0;
p->filter = NULL;
if (!(allocated_filter_string[0] == '*' && allocated_filter_string[1] == 0))
p->filter = allocated_filter_string;
else
/* Three ways to clear filter: NULL, "", "*" */
if (allocated_filter_string == NULL ||
allocated_filter_string[0] == '\0' ||
(allocated_filter_string[0] == '*' && allocated_filter_string[1] == '\0'))
g_free (allocated_filter_string);
else
p->filter = allocated_filter_string;
reread_cmd ();
}

View File

@ -1584,8 +1584,7 @@ panel_print_header (const WPanel * panel)
g_string_append (format_txt, format->title);
if (panel->filter != NULL && *panel->filter != '\0'
&& strcmp (format->id, "name") == 0)
if (panel->filter != NULL && strcmp (format->id, "name") == 0)
{
g_string_append (format_txt, " [");
g_string_append (format_txt, panel->filter);