From 79d44d87a3c47f268f9161583f6220e36fd1013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 2 Jul 2017 09:42:08 +0200 Subject: [PATCH] fset: do not reset selected line after options are added/removed --- src/plugins/fset/fset-option.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 8ee364374..ab13b9367 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1423,7 +1423,14 @@ fset_option_config_changed (const char *option_name) if (full_refresh) { fset_option_get_options (); - fset_buffer_selected_line = 0; + num_options = weechat_arraylist_size (fset_options); + if (num_options > 0) + { + if (fset_buffer_selected_line >= num_options) + fset_buffer_selected_line = num_options - 1; + } + else + fset_buffer_selected_line = 0; fset_buffer_refresh (1); } else