diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-02-22 21:33:39 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-02-22 21:33:39 +0100 |
commit | baa598276c4aba57dc9e91ffae46b1477c0d0fe1 (patch) | |
tree | ceddbbe0dcd517bc014d17459fdd489d043b3636 /src | |
parent | 355843b27a74d6a0f796b23231b49ae24f8ec3ff (diff) | |
download | weechat-baa598276c4aba57dc9e91ffae46b1477c0d0fe1.zip |
fset: fix slow refresh of fset buffer during /reload (closes #1313)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fset/fset-option.c | 31 | ||||
-rw-r--r-- | src/plugins/fset/fset-option.h | 2 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index c192182c3..895b633e2 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1491,9 +1491,20 @@ fset_option_config_timer_cb (const void *pointer, (void) data; (void) remaining_calls; - weechat_hashtable_map (fset_option_timer_options_changed, - &fset_option_timer_option_changed_cb, - NULL); + if (weechat_hashtable_get_integer ( + fset_option_timer_options_changed, + "items_count") >= FSET_OPTION_TIMER_MAX_OPTIONS_CHANGED) + { + fset_option_get_options (); + fset_buffer_refresh (1); + } + else + { + weechat_hashtable_map (fset_option_timer_options_changed, + &fset_option_timer_option_changed_cb, + NULL); + } + weechat_hashtable_remove_all (fset_option_timer_options_changed); fset_option_timer_hook = NULL; @@ -1527,8 +1538,18 @@ fset_option_config_cb (const void *pointer, if (ptr_info && (strcmp (ptr_info, "1") == 0)) return WEECHAT_RC_OK; - weechat_hashtable_set (fset_option_timer_options_changed, - option, NULL); + /* + * we limit the number of options to display with the timer; for example + * on /reload, many options are changed, so we'll get all options and + * display them, instead of change them one by one, which is very slow + */ + if (weechat_hashtable_get_integer ( + fset_option_timer_options_changed, + "items_count") < FSET_OPTION_TIMER_MAX_OPTIONS_CHANGED) + { + weechat_hashtable_set (fset_option_timer_options_changed, + option, NULL); + } if (!fset_option_timer_hook) { diff --git a/src/plugins/fset/fset-option.h b/src/plugins/fset/fset-option.h index 34e607486..3800dd437 100644 --- a/src/plugins/fset/fset-option.h +++ b/src/plugins/fset/fset-option.h @@ -22,6 +22,8 @@ #define FSET_OPTION_VALUE_NULL "null" +#define FSET_OPTION_TIMER_MAX_OPTIONS_CHANGED 32 + enum t_fset_option_type { FSET_OPTION_TYPE_BOOLEAN = 0, |