From 0dc1b4acaf90110b6f274c22338a1badde1d6c86 Mon Sep 17 00:00:00 2001 From: aileot <46470475+aileot@users.noreply.github.com> Date: Fri, 2 Sep 2022 21:23:23 +0900 Subject: [PATCH] Fix: get jump distance in apparent cursor height This commit will stop unexpected flashes when cursor moves around folded lines. --- lua/specs/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/specs/init.lua b/lua/specs/init.lua index 4857275..e17d095 100644 --- a/lua/specs/init.lua +++ b/lua/specs/init.lua @@ -5,9 +5,9 @@ local old_cur local au_toggle function M.on_cursor_moved() - local cur = vim.api.nvim_win_get_cursor(0) + local cur = vim.fn.winline() + vim.api.nvim_win_get_position(0)[1] if old_cur then - local jump = math.abs(cur[1]-old_cur[1]) + local jump = math.abs(cur-old_cur) if jump >= opts.min_jump then M.show_specs() end