diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-12 13:02:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 13:02:27 +0800 |
commit | 929e1b7f1c35679424989f5ebfc78f095bb434d9 (patch) | |
tree | 9926fa873746da91cb2564c4d2606ff11829817e /test/functional | |
parent | 950a0ac61c70362f168338b815675ac60b1d72dc (diff) | |
download | rneovim-929e1b7f1c35679424989f5ebfc78f095bb434d9.tar.gz rneovim-929e1b7f1c35679424989f5ebfc78f095bb434d9.tar.bz2 rneovim-929e1b7f1c35679424989f5ebfc78f095bb434d9.zip |
perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)
Invalidation of most w_valid flags isn't needed when adding or removing
virtual text below cursor.
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index bb24b775c1..9f38c05757 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -3882,16 +3882,31 @@ if (h->n_buckets < new_n_buckets) { // expand it('works with one line', function() insert(example_text2) - feed 'gg' + feed '2gg' + screen:expect{grid=[[ + if (h->n_buckets < new_n_buckets) { // expand | + ^khkey_t *new_keys = (khkey_t *)krealloc((void *)| + h->keys, new_n_buckets * sizeof(khkey_t)); | + h->keys = new_keys; | + if (kh_is_map && val_size) { | + char *new_vals = krealloc( h->vals_buf, new_n_| + buckets * val_size); | + h->vals_buf = new_vals; | + } | + } | + {1:~ }| + | + ]]} + api.nvim_buf_set_extmark(0, ns, 1, 33, { virt_lines={ {{">> ", "NonText"}, {"krealloc", "Identifier"}, {": change the size of an allocation"}}}; virt_lines_above=true; }) screen:expect{grid=[[ - ^if (h->n_buckets < new_n_buckets) { // expand | + if (h->n_buckets < new_n_buckets) { // expand | {1:>> }{2:krealloc}: change the size of an allocation | - khkey_t *new_keys = (khkey_t *)krealloc((void *)| + ^khkey_t *new_keys = (khkey_t *)krealloc((void *)| h->keys, new_n_buckets * sizeof(khkey_t)); | h->keys = new_keys; | if (kh_is_map && val_size) { | @@ -3955,7 +3970,6 @@ if (h->n_buckets < new_n_buckets) { // expand api.nvim_buf_set_extmark(0, ns, 5, 0, { virt_lines = { {{"^^ REVIEW:", "Todo"}, {" new_vals variable seems unnecessary?", "Comment"}} }; }) - -- TODO: what about the cursor?? screen:expect{grid=[[ if (h->n_buckets < new_n_buckets) { // expand | khkey_t *new_keys = (khkey_t *) | @@ -3972,7 +3986,6 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} api.nvim_buf_clear_namespace(0, ns, 0, -1) - -- Cursor should be drawn on the correct line. #22704 screen:expect{grid=[[ if (h->n_buckets < new_n_buckets) { // expand | khkey_t *new_keys = (khkey_t *) | @@ -4604,22 +4617,24 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} feed('gg') - feed('dd') + feed('yyp') screen:expect{grid=[[ - ^line2 | + line1 | foo | bar | baz | + ^line1 | + line2 | line3 | line4 | line5 | - {1:~ }|*4 + {1:~ }|*2 | ]]} - feed('yyp') + feed('dd') screen:expect{grid=[[ - line2 | + line1 | foo | bar | baz | @@ -4630,6 +4645,19 @@ if (h->n_buckets < new_n_buckets) { // expand {1:~ }|*3 | ]]} + + feed('kdd') + screen:expect([[ + ^line2 | + foo | + bar | + baz | + line3 | + line4 | + line5 | + {1:~ }|*4 + | + ]]) end) end) |