diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-12-06 13:34:19 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2023-12-07 14:22:24 +0000 |
commit | 4a34da82c18e6da1e46d6bf3d21082a6b6c8b947 (patch) | |
tree | 0f9b6b45e4aa4a757526e6727ca9943b8170ba87 /src/nvim/option.c | |
parent | e42f03264b424450b560a69994879f09b6c555d8 (diff) | |
download | rneovim-4a34da82c18e6da1e46d6bf3d21082a6b6c8b947.tar.gz rneovim-4a34da82c18e6da1e46d6bf3d21082a6b6c8b947.tar.bz2 rneovim-4a34da82c18e6da1e46d6bf3d21082a6b6c8b947.zip |
perf(column): keep track of number of lines that hold up the 'signcolumn'
Problem: The entire marktree needs to be traversed each time a sign is
removed from the sentinel line.
Solution: Remove sentinel line and instead keep track of the number of
lines that hold up the 'signcolumn' in "max_count". Adjust this
number for added/removed signs, and set it to 0 when the
maximum number of signs on a line changes. Only when
"max_count" is decremented to 0 due to sign removal do we need
to check the entire buffer.
Also replace "invalid_top" and "invalid_bot" with a map of
invalid ranges, further reducing the number of lines to be
checked.
Also improve tree traversal when counting the number of signs.
Instead of looping over the to be checked range and counting
the overlap for each row, keep track of the overlap in an
array and add this to the count.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index ba9d1262d4..c9d65c5683 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -6172,20 +6172,6 @@ bool fish_like_shell(void) return strstr(path_tail(p_sh), "fish") != NULL; } -/// Return the number of requested sign columns, based on current -/// buffer signs and on user configuration. -int win_signcol_count(win_T *wp) -{ - if (wp->w_minscwidth <= SCL_NO) { - return 0; - } - - int needed_signcols = buf_signcols(wp->w_buffer, wp->w_maxscwidth); - int ret = MAX(wp->w_minscwidth, MIN(wp->w_maxscwidth, needed_signcols)); - assert(ret <= SIGN_SHOW_MAX); - return ret; -} - /// Get window or buffer local options dict_T *get_winbuf_options(const int bufopt) FUNC_ATTR_WARN_UNUSED_RESULT |