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

calling setreg cause cursor to blink #28797

Closed
xzbdmw opened this issue May 17, 2024 · 2 comments
Closed

calling setreg cause cursor to blink #28797

xzbdmw opened this issue May 17, 2024 · 2 comments
Labels
clipboard clipboard, paste event-loop events events, autocommands job-control OS processes, spawn

Comments

@xzbdmw
Copy link

xzbdmw commented May 17, 2024

Problem

iShot_2024-05-17_08.58.00.mp4

typing dd and cursor will filker if vim.fn.setreg("+", now) is called

Steps to reproduce

local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "--single-branch",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
    -- do not remove the colorscheme!
    "folke/tokyonight.nvim",
    -- add any other pugins here
}

require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

-- add anything else here
-- vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])
vim.keymap.set("n", "d", function()
    vim.defer_fn(function()
        local now = vim.fn.getreg('"')
        vim.fn.setreg("+", now)
    end, 1000)
    return "d"
end, { expr = true })
  1. touch ~/.config/nvim/repro.lua
  2. nvim -u ~/.config/nvim/repro.lua ~/.config/nvim/repro.lua
  3. dd
  4. see the cursor blinking(flikering)

Expected behavior

cursor will not fliker

Neovim version (nvim -v)

NVIM v0.10.0-dev-3101+gc18d7941e-dirty Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

Vim (not Nvim) behaves the same?

don't know

Operating system/version

macos 14.2

Terminal name/version

kitty, neovide

$TERM environment variable

xterm-kitty

Installation

build from source

@xzbdmw xzbdmw added the bug issues reporting wrong behavior label May 17, 2024
@zeertzjq zeertzjq added the clipboard clipboard, paste label May 17, 2024
@justinmk
Copy link
Member

justinmk commented May 17, 2024

vim.fn.setreg("+", now)

I knew without looking this would involve clipboard. The cursor flicker indicates a job/process invocation.

Also just the fact that your repro involves extra plugins, is a signal that some sort of event handler is listening to something.

The cursor blinks when work happens.

@justinmk justinmk closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
@justinmk justinmk added job-control OS processes, spawn event-loop events events, autocommands and removed bug issues reporting wrong behavior labels May 17, 2024
@xzbdmw
Copy link
Author

xzbdmw commented May 17, 2024

@justinmk Is the cursor flikering inevitable when job started? It seems only flickers when setrrg is called, If I manually sync clipboard using pbcopy with vim.system, there is no flikering.

cursor blinks when work happens.

What’s the meaning of work here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clipboard clipboard, paste event-loop events events, autocommands job-control OS processes, spawn
Projects
None yet
Development

No branches or pull requests

3 participants