perf(statusline): UI elements are always redrawn on K_EVENT

Problem:    'statusline'-format UI elements are redrawn on each K_EVENT.
Solution:   Only redraw UI elements when something relevant has changed.
This commit is contained in:
Luuk van Baal
2023-03-08 12:36:03 +01:00
parent 1fb585a9db
commit fe11079721
7 changed files with 167 additions and 151 deletions

View File

@@ -92,6 +92,7 @@
#include "nvim/spell.h"
#include "nvim/spellfile.h"
#include "nvim/spellsuggest.h"
#include "nvim/statusline.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/terminal.h"
@@ -2251,8 +2252,13 @@ static char *set_bool_option(const int opt_idx, char *const varp, const int valu
ui_call_option_set(cstr_as_string(options[opt_idx].fullname),
BOOLEAN_OBJ(*varp));
}
comp_col(); // in case 'ruler' or 'showcmd' changed
if ((int *)varp == &p_ru || (int *)varp == &p_sc) {
// in case 'ruler' or 'showcmd' changed
comp_col();
if ((int *)varp == &p_ru) {
win_redr_ruler(curwin);
}
}
if (curwin->w_curswant != MAXCOL
&& (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) {
curwin->w_set_curswant = true;