diff --git a/ChangeLog.adoc b/ChangeLog.adoc index a560c29bc..f74238892 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -24,6 +24,7 @@ New features:: 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) Documentation:: diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 6159d3bf1..3c1404a57 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -973,7 +973,7 @@ gui_bar_config_check_size (const void *pointer, void *data, struct t_gui_bar *ptr_bar; long number; char *error; - int new_value; + int new_value, current_size; /* make C compiler happy */ (void) pointer; @@ -1013,14 +1013,16 @@ gui_bar_config_check_size (const void *pointer, void *data, if (new_value < 0) return 0; - if ((new_value > 0) && - ((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])) { - if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) - && !gui_bar_check_size_add (ptr_bar, - new_value - CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]))) + current_size = CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_SIZE]); + if ((current_size == 0) && ptr_bar->bar_window) + 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 1;