Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lazyredraw to avoid flicking #1167

Closed
wants to merge 4 commits into from
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
2 changes: 1 addition & 1 deletion doc/luasnip.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 April 30
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 May 06

==============================================================================
Table of Contents *luasnip-table-of-contents*
Expand Down
8 changes: 4 additions & 4 deletions lua/luasnip/util/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,11 @@ end
local function any_select(b, e)
-- stylua: ignore
replace_feedkeys(
-- this esc -> movement sometimes leads to a slight flicker
-- TODO: look into preventing that reliably.
-- Go into visual, then place endpoints.
-- This is to allow us to place the cursor on the \n of a line.
-- see #1158
"<esc>"
"<Cmd>setlocal lazyredraw<CR>"
.. "<esc>"
-- open folds that contain this selection.
-- we assume that the selection is contained in at most one fold, and
-- that that fold covers b.
Expand All @@ -187,7 +186,8 @@ local function any_select(b, e)
cursor_set_keys(e) or
-- set before
cursor_set_keys(e, true))
.. "o<C-G><C-r>_" )
.. "o<C-G><C-r>_"
.. string.format("<Cmd>setlocal %slazyredraw<CR>", vim.o.lazyredraw and "" or "no"))
end

local function normal_move_on_insert(new_cur_pos)
Expand Down
Loading