mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
feat(api): add nvim__redraw for more granular redrawing
Experimental and subject to future changes. Add a way to redraw certain elements that are not redrawn while Nvim is waiting for input, or currently have no API to do so. This API covers all that can be done with the :redraw* commands, in addition to the following new features: - Immediately move the cursor to a (non-current) window. - Target a specific window or buffer to mark for redraw. - Mark a buffer range for redraw (replaces nvim__buf_redraw_range()). - Redraw the 'statuscolumn'.
This commit is contained in:
@@ -77,6 +77,23 @@ int xctz(uint64_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Count number of set bits in bit field.
|
||||
int popcount(uint64_t x)
|
||||
{
|
||||
// Use compiler builtin if possible.
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
return __builtin_popcountll(x);
|
||||
#else
|
||||
int count = 0;
|
||||
for (; x != 0; x >>= 1) {
|
||||
if (x & 1) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// For overflow detection, add a digit safely to an int value.
|
||||
int vim_append_digit_int(int *value, int digit)
|
||||
{
|
||||
|
Reference in New Issue
Block a user