diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2024-04-10 21:18:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 20:18:14 +0800 |
commit | 889f81c65fa4318ab0fba391904dc43e5633b13e (patch) | |
tree | 10802b6ad359e6e9422ef5a6d88af0d53f29dedc /test/functional/ui/decorations_spec.lua | |
parent | 1dacf2ecee36e2abd490df2ad5f9c24fa73205b7 (diff) | |
download | rneovim-889f81c65fa4318ab0fba391904dc43e5633b13e.tar.gz rneovim-889f81c65fa4318ab0fba391904dc43e5633b13e.tar.bz2 rneovim-889f81c65fa4318ab0fba391904dc43e5633b13e.zip |
fix(drawline): don't invoke on_line for filler line (#28219)
Problem:
Decoration provider `on_line` handler is invoked for diff filler line
below the last buffer line. This does not match the documentation:
"called for each buffer line".
Solution:
Check `end_fill`.
Diffstat (limited to 'test/functional/ui/decorations_spec.lua')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 924e4107db..21aa6e1909 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -667,6 +667,33 @@ describe('decorations providers', function() ]]) end) + it('on_line is invoked only for buffer lines', function() + insert(mulholland) + command('vnew') + insert(mulholland) + feed('dd') + command('windo diffthis') + + exec_lua([[ + out_of_bound = false + ]]) + setup_provider([[ + local function on_do(kind, _, bufnr, row) + if kind == 'line' then + if not api.nvim_buf_get_lines(bufnr, row, row + 1, false)[1] then + out_of_bound = true + end + end + end + ]]) + + feed('<C-e>') + + exec_lua([[ + assert(out_of_bound == false) + ]]) + end) + it('errors gracefully', function() insert(mulholland) |