Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lua/mini/animate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,9 @@ H.create_autocommands = function()
-- end). Use `vim.schedule()` to make it affect state only after scroll is
-- done and cursor is already in correct final position.
au('CursorMoved', '*', vim.schedule_wrap(H.track_scroll_state_partial), 'Track partial scroll state')
au('CmdlineLeave', '*', H.on_cmdline_leave, 'On CmdlineLeave')

-- TODO: Remove after Neovim=0.12 support is dropped
if vim.fn.has('nvim-0.13') == 0 then au('CmdlineLeave', '*', H.on_cmdline_leave, 'On CmdlineLeave') end

-- Use `vim.schedule_wrap()` animation to get a window data used for
-- displaying (and not one after just opening). Useful for 'nvim-tree'.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|---------|-----
01|hhhh
02|iiii
03|jjjj
04|kkkk
05|llll
06|mmmm
07|nnnn
08|oooo
09|[No Name] 15,1
10|/oo ...[1/2]

--|---------|---------|-----
01|0000000000000000000000000
02|0000000000000000000000000
03|0000000000000000000000000
04|0000000000000000000000000
05|0000000000000000000000000
06|0000000000000000000000000
07|0000000000000000000000000
08|1122000000000000000000000
09|3333333333333333333333333
10|4444444444444444444444444
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|---------|-----
01|iiii
02|jjjj
03|kkkk
04|llll
05|mmmm
06|nnnn
07|oooo
08|~
09|[No Name] 9,1
10|/oo ...[1/2]

--|---------|---------|-----
01|0000000000000000000000000
02|0000000000000000000000000
03|0000000000000000000000000
04|0000000000000000000000000
05|0000000000000000000000000
06|0000000000000000000000000
07|1111000000000000000000000
08|2222222222222222222222222
09|3333333333333333333333333
10|4444444444444444444444444
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|---------|-----
01|aaaa
02|bbbb
03|cccc
04|dddd
05|eeee
06|ffff
07|gggg
08|hhhh
09|[No Name] 1,3
10|?aa ...[2/2]

--|---------|---------|-----
01|0011222222222222222222222
02|2222222222222222222222222
03|2222222222222222222222222
04|2222222222222222222222222
05|2222222222222222222222222
06|2222222222222222222222222
07|2222222222222222222222222
08|2222222222222222222222222
09|3333333333333333333333333
10|4444444444444444444444444
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|---------|-----
01|aaaa
02|bbbb
03|cccc
04|dddd
05|eeee
06|ffff
07|gggg
08|hhhh
09|[No Name] 8,2
10|?aa ...[2/2]

--|---------|---------|-----
01|0000111111111111111111111
02|1111111111111111111111111
03|1111111111111111111111111
04|1111111111111111111111111
05|1111111111111111111111111
06|1111111111111111111111111
07|1111111111111111111111111
08|1111111111111111111111111
09|2222222222222222222222222
10|3333333333333333333333333
24 changes: 24 additions & 0 deletions tests/test_animate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,8 @@ T['Scroll']['does not automatically animate after buffer change'] = function()
end

T['Scroll']["does not automatically animate result of 'incsearch'"] = function()
if child.fn.has('nvim-0.13') == 1 then return end

child.o.incsearch = true

child.set_size(10, 25)
Expand All @@ -1869,6 +1871,28 @@ T['Scroll']["does not automatically animate result of 'incsearch'"] = function()
child.expect_screenshot()
end

T['Scroll']["automatically animates result of 'incsearch' on nvim>=0.13"] = function()
if child.fn.has('nvim-0.13') == 0 then return end

child.o.incsearch = true

child.set_size(10, 25)

-- Should work for search with `/`
type_keys('/', 'oo', '<CR>')
child.expect_screenshot()
sleep(step_time + small_time)
-- Should start animation
child.expect_screenshot()

-- Should work for search with `?`
type_keys('?', 'aa', '<CR>')
child.expect_screenshot()
sleep(step_time + small_time)
-- Should start animation
child.expect_screenshot()
end

T['Scroll']['does not animate in Select mode'] = function()
child.set_size(5, 15)
child.cmd('smap <M-m> <Cmd>call winrestview({ "topline": 3 })<CR>')
Expand Down
Loading