diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-01-02 11:05:30 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-01-03 14:47:37 +0100 |
commit | a58d96a7edcf94913ce29135f06d83ca2c22b202 (patch) | |
tree | d6058974f95cee73aa36f969d6f37e451bfb5e9a /test/functional/treesitter/highlight_spec.lua | |
parent | adb01190c44b355da61469d39d0a51dbf84c4e3f (diff) | |
download | rneovim-a58d96a7edcf94913ce29135f06d83ca2c22b202.tar.gz rneovim-a58d96a7edcf94913ce29135f06d83ca2c22b202.tar.bz2 rneovim-a58d96a7edcf94913ce29135f06d83ca2c22b202.zip |
buffer updates: mark sorted region as changed.
NB: currently this invalidates all extmarks inside the region.
Later on within-line extmarks could be preserved
Diffstat (limited to 'test/functional/treesitter/highlight_spec.lua')
-rw-r--r-- | test/functional/treesitter/highlight_spec.lua | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 33fdabe656..cb73bfbbe1 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -270,6 +270,81 @@ describe('treesitter highlighting', function() ]]} end) + it('is updated with :sort', function() + if pending_c_parser(pending) then return end + + insert(test_text) + exec_lua [[ + local parser = vim.treesitter.get_parser(0, "c") + test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query}}) + ]] + screen:expect{grid=[[ + {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | + {3:bool} ext_widgets[kUIExtCount]; | + {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | + ext_widgets[i] = true; | + } | + | + {3:bool} inclusive = ui_override(); | + {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | + {3:UI} *ui = uis[i]; | + width = {5:MIN}(ui->width, width); | + height = {5:MIN}(ui->height, height); | + foo = {5:BAR}(ui->bazaar, bazaar); | + {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + } | + } | + ^} | + | + ]]} + + feed ":sort<cr>" + screen:expect{grid=[[ + ^ | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + {3:UI} *ui = uis[i]; | + ext_widgets[i] = true; | + foo = {5:BAR}(ui->bazaar, bazaar); | + {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | + height = {5:MIN}(ui->height, height); | + width = {5:MIN}(ui->width, width); | + } | + {3:bool} ext_widgets[kUIExtCount]; | + {3:bool} inclusive = ui_override(); | + {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | + {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | + {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | + } | + } | + {3:void} ui_refresh({3:void}) | + :sort | + ]]} + + feed "u" + + screen:expect{grid=[[ + {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | + {3:bool} ext_widgets[kUIExtCount]; | + {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | + ext_widgets[i] = true; | + } | + | + {3:bool} inclusive = ui_override(); | + {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | + {3:UI} *ui = uis[i]; | + width = {5:MIN}(ui->width, width); | + height = {5:MIN}(ui->height, height); | + foo = {5:BAR}(ui->bazaar, bazaar); | + {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + } | + } | + ^} | + 19 changes; before #2 {MATCH:.*}| + ]]} + end) + it("supports with custom parser", function() if pending_c_parser(pending) then return end |