diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-02-12 19:40:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 19:40:44 +0100 |
commit | 05c3d02380770445983914dae1bf48e6ef37a6f6 (patch) | |
tree | 00246caffdcdb17e5318610fe39b317c08080e4f /src/nvim/option.c | |
parent | 7db0aa027cff8da11a3fe2c26267a059f35297d7 (diff) | |
parent | 50250542c346473dd3a91ce63cd989033dae4471 (diff) | |
download | rneovim-05c3d02380770445983914dae1bf48e6ef37a6f6.tar.gz rneovim-05c3d02380770445983914dae1bf48e6ef37a6f6.tar.bz2 rneovim-05c3d02380770445983914dae1bf48e6ef37a6f6.zip |
Merge pull request #17383 from lewis6991/sign_eff
refactor(signs): more efficient signcol calc
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index dddf926b9a..df5f352258 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -8046,7 +8046,6 @@ int win_signcol_count(win_T *wp) /// Return the number of requested sign columns, based on user / configuration. int win_signcol_configured(win_T *wp, int *is_fixed) { - int minimum = 0, maximum = 1, needed_signcols; const char *scl = (const char *)wp->w_p_scl; if (is_fixed) { @@ -8059,7 +8058,6 @@ int win_signcol_configured(win_T *wp, int *is_fixed) && (wp->w_p_nu || wp->w_p_rnu)))) { return 0; } - needed_signcols = buf_signcols(wp->w_buffer); // yes or yes if (!strncmp(scl, "yes:", 4)) { @@ -8075,6 +8073,8 @@ int win_signcol_configured(win_T *wp, int *is_fixed) *is_fixed = 0; } + int minimum = 0, maximum = 1; + if (!strncmp(scl, "auto:", 5)) { // Variable depending on a configuration maximum = scl[5] - '0'; @@ -8085,7 +8085,8 @@ int win_signcol_configured(win_T *wp, int *is_fixed) } } - int ret = MAX(minimum, MIN(maximum, needed_signcols)); + int needed_signcols = buf_signcols(wp->w_buffer, maximum); + int ret = MAX(minimum, needed_signcols); assert(ret <= SIGN_SHOW_MAX); return ret; } |