core: fix resize of a bar when its size is 0 (automatic) (closes #1470)

master
Sébastien Helleu 2020-04-07 19:00:33 +02:00
parent fdd39c6b97
commit e998417f5c
2 changed files with 10 additions and 7 deletions

View File

@ -24,6 +24,7 @@ New features::
Bug fixes:: Bug fixes::
* core: fix resize of a bar when its size is 0 (automatic) (issue #1470)
* python: fix crash when invalid UTF-8 string is in a WeeChat hashtable converted to a Python dict (issue #1463) * python: fix crash when invalid UTF-8 string is in a WeeChat hashtable converted to a Python dict (issue #1463)
Documentation:: Documentation::

View File

@ -973,7 +973,7 @@ gui_bar_config_check_size (const void *pointer, void *data,
struct t_gui_bar *ptr_bar; struct t_gui_bar *ptr_bar;
long number; long number;
char *error; char *error;
int new_value; int new_value, current_size;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@ -1013,14 +1013,16 @@ gui_bar_config_check_size (const void *pointer, void *data,
if (new_value < 0) if (new_value < 0)
return 0; return 0;
if ((new_value > 0) && if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
((CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]) == 0)
|| (new_value > CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]))))
{ {
if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) current_size = CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]);
&& !gui_bar_check_size_add (ptr_bar, if ((current_size == 0) && ptr_bar->bar_window)
new_value - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]))) current_size = ptr_bar->bar_window->current_size;
if ((new_value > 0) && (new_value > current_size)
&& !gui_bar_check_size_add (ptr_bar, new_value - current_size))
{
return 0; return 0;
}
} }
return 1; return 1;