diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-05-03 18:02:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-03 18:02:25 +0800 |
| commit | d44ed3a885e163df33cce8180ca9f72fb5c0661a (patch) | |
| tree | 48c5c793cc69a1bf35c712885bf123e7654e37d7 /test/functional/api/extmark_spec.lua | |
| parent | cf9f002f31c8b4d9d42912a3f45f5d3db4462fd9 (diff) | |
| download | rneovim-d44ed3a885e163df33cce8180ca9f72fb5c0661a.tar.gz rneovim-d44ed3a885e163df33cce8180ca9f72fb5c0661a.tar.bz2 rneovim-d44ed3a885e163df33cce8180ca9f72fb5c0661a.zip | |
perf(extmarks): better track whether namespace has extmarks (#28615)
This avoids redraw when adding/removing an empty namespace for a window.
This also avoids marktree traversal when clearing a namespace that has
already been cleared, which is added as a benchmark.
Diffstat (limited to 'test/functional/api/extmark_spec.lua')
| -rw-r--r-- | test/functional/api/extmark_spec.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 70bdb050e5..965a60417a 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -1896,6 +1896,24 @@ describe('Extmarks buffer api with many marks', function() end eq(ns_marks[ns1], get_marks(ns1)) eq(ns_marks[ns2], get_marks(ns2)) + + api.nvim_buf_clear_namespace(0, ns1, 0, 10) + for id, mark in pairs(ns_marks[ns1]) do + if mark[1] < 10 then + ns_marks[ns1][id] = nil + end + end + eq(ns_marks[ns1], get_marks(ns1)) + eq(ns_marks[ns2], get_marks(ns2)) + + api.nvim_buf_clear_namespace(0, ns1, 20, -1) + for id, mark in pairs(ns_marks[ns1]) do + if mark[1] >= 20 then + ns_marks[ns1][id] = nil + end + end + eq(ns_marks[ns1], get_marks(ns1)) + eq(ns_marks[ns2], get_marks(ns2)) end) it('can delete line', function() |