gen740 / SmoothCursor.nvim

MIT License
342 stars 13 forks source link

The tail of the cursor is kept there on the floating window even with `disable_float_win = true` #33

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

Sorry for my abstract title... In short, I'm seeing this bug:

(Thanks for your help, again!)

https://user-images.githubusercontent.com/24765272/216315028-2dee99a3-37ae-4c2f-88a8-b34fa1b16dbf.mov

This is the config I use:

use {
  'gen740/SmoothCursor.nvim',
  config = function()
    require('smoothcursor').setup {
      autostart = true,
      fancy = { enable = true },
      threshold = 1,
      flyin_effect = 'top',
      disable_float_win = true,
    }
  end
}
gen740 commented 1 year ago

Could you make a minimum reproduction procedure?

nyngwang commented 1 year ago

@gen740 Here it is: (Really sorry that I didn't provide it at the moment I posted it!)

Steps:

(Remember to remove the .repro/ folder created under the path where you run the nvim -u ... command after testing!)

-- ref: https://github.com/folke/lazy.nvim/wiki/Minimal-%60init.lua%60-to-Reproduce-an-Issue

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
  {
    'nyngwang/NeoZoom.lua',
    config = function ()
      require('neo-zoom').setup()
      vim.keymap.set('n', '<CR>', function () vim.cmd('NeoZoomToggle') end, { silent = true, nowait = true })
    end
  },
  {
    'gen740/SmoothCursor.nvim',
    config = function()
      require('smoothcursor').setup {
        autostart = true,
        fancy = { enable = true },
        threshold = 1,
        flyin_effect = 'top',
        disable_float_win = true,
      }
    end
  }
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])
gen740 commented 1 year ago

I can reproduce it! But, I have no idea what causes this problem.

FYI, there is a debug function require("smoothcursor.debug").debug() to show smoothcursor inner status (like information of in which buffer smoothcursor is enabled)

gen740 commented 1 year ago

Maybe flyin_effect will have something to do with this problem... (And might be async function things)

gen740 commented 1 year ago

And writing these comments... I came up with a solution. I will create a PR soon.

gen740 commented 1 year ago

Sad news, though. This didn't fix the problem. I have no idea how to fix it...

But, this problem occurs when opening the floating window frequently so many times in a row with the fly_in effect enabled. So I have to say, this is not a fatal problem.

nyngwang commented 1 year ago

Sad news, though. This didn't fix the problem. I have no idea how to fix it...

@gen740 Nevermind! You can do whatever you want with this issue, at your pace. (but yes, I still hope this can be fixed someday. I'm not in a hurry for the solution)

(btw, this might be a piece of good news for you: Since I always enable your plugin when recording my plugin DEMOs, people were asking about your plugin. This should increase your users/audiences!)

nyngwang commented 1 year ago

@gen740 Just confirmed that it works! Thank you a lot!! (I recently also fixed a lot of bugs on NeoZoom.lua, if you want to try.)