Skip to content

Commit 9b5cd2a

Browse files
committed
fix(paste): defer paste animation
1 parent 114c384 commit 9b5cd2a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/tiny-glimmer/overwrite/paste.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local M = {}
22
local utils = require("tiny-glimmer.utils")
3+
local AnimationFactory = require("tiny-glimmer.animation.factory")
34

45
local function split_lines(text)
56
local lines = {}
@@ -17,17 +18,17 @@ local function animate_paste(opts, mode)
1718
local register = vim.v.register or '"'
1819
local text = split_lines(vim.fn.getreg(register, true))
1920

20-
vim.schedule(function()
21+
vim.defer_fn(function()
2122
local range = utils.get_range_yank()
2223

23-
require("tiny-glimmer.animation.factory").get_instance():create_text_animation(opts.default_animation, {
24+
AnimationFactory.get_instance():create_text_animation(opts.default_animation, {
2425
base = {
2526
range = range,
2627
},
2728
is_paste = true,
2829
content = text,
2930
})
30-
end)
31+
end, 10)
3132
end
3233

3334
function M.paste(opts)

0 commit comments

Comments
 (0)