lewis6991 / satellite.nvim

Decorate scrollbar for Neovim
MIT License
542 stars 20 forks source link

Scrolling with mouse - click offset issue #56

Closed Jendker closed 1 week ago

Jendker commented 11 months ago

Describe the bug Currently to scroll by clicking and dragging it's necessary to click at the upper half of the scrollbar to ensure the click is registered on the scrollbar. It is even possible to click above the scrollbar and the dragging is possible. This is especially visible on the longer files when the scrollbar is short - I tried with 500 lines file. There seems to be an offset.

To Reproduce Steps to reproduce the behavior:

  1. Open large file
  2. Click at the end of the scrollbar and drag
  3. Window doesn't scroll <---- not expected
  4. Try clicking slightly above scrollbar and dragging
  5. Window scrolls <---- not expected
  6. Try clicking at the upper half scrollbar and dragging
  7. Window scrolls <---- as expected

Video

https://imgur.com/a/w2V7fkA

Additional context Tested with a minimal config.

-- DO NOT change the paths and don't remove the colorscheme
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 = {
  {
    'lewis6991/satellite.nvim',
    opts = {},
  }

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

A note which may be helpful: strangely at the beginning of dragging the scrollbar jumps by some offset under the mouse, later it seems to be following the mouse drag as expected. I understand that this might not be top-priority issue since not many users use mouse but it still is a bit confusing and probably worth investigating.

xizonghu commented 1 month ago

I have this problem too

Jendker commented 1 month ago

xizonghu > I have this problem too

You can use https://github.com/dstein64/nvim-scrollview, I had very good experience with it.

Servostar commented 1 week ago

Seems to be exactly 1 row offset above