dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
517 stars 9 forks source link

gitsigns spacing and colour #129

Closed sho-87 closed 3 months ago

sho-87 commented 3 months ago

ive noticed a couple of problems with gitsigns re: spacing and colour

Spacing

image

if you look at gitsigns on the left of my screen you'll see changes to 3 consecutive rows.

in scrollview on the right there is additional space between each sign, as well as the mark

looks like this is because the #lines is less than the height of the window, so the scrollview needs to stretch the placement of things to cover the entire height. this can be confirmed by just changing the height of the nvim window:

image

Colour

the colour for added lines is incorrect. it shows up as yellow but, as you can see from the left of the image above, gitsigns has it configured as green

dstein64 commented 3 months ago

The spacing issue is addressed as of PR #130. When scrollview_always_show is used and a sign for gitsigns would correspond to multiple rows of the scrollview column, all those rows will be used.

@sho-87, can you provide steps for reproducing the other issue? Something like:

$ git clone <REPO>
$ git checkout <COMMIT>
$ nvim
# plus a list of edits to the file to reproduce the issue
sho-87 commented 3 months ago

@dstein64

to reproduce, here is a fresh config that bootstraps lazy and grabs scrollview and gitsigns at specific commits:

init.lua:

local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
  vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    "lewis6991/gitsigns.nvim",
    commit = "078041e",
    config = function(_, opt)
      require('gitsigns').setup {
        signcolumn = true,
    }
    end
  },
  {
    "dstein64/nvim-scrollview",
    commit = "1d80f72",
    config = function(_, opts)
      require("scrollview").setup(opts)
      require("scrollview.contrib.gitsigns").setup(opts)
    end,
    opts = {
      always_show = true,
      column=40,
    }
  },
})
  1. git init in a directory, create a new file, and commit it. I just used some random text like:
    jkh
    jklsdfh
    sdf
    sdf
    sdf
    sdf
    sdf
    sdf
    sdf
    sdfdsf
    asdasdasd
    isdfsdf
  2. nvim using the config above
  3. add a new line to the end of the file and you'll see this, which is the correct colour for an addition: image
  4. go to the line above and change it, and this is where it goes wrong: image

the marker is still there for the line addition, but the colour that used to be the correct blue has now turned into purple

dstein64 commented 3 months ago

The second issue is fixed in 5a7eb7e6c1b921761615b57a6140d73b1cc2b034. A gitsigns change hunk could be comprised of a change and an addition. The existing code was assuming it was only a change, with no addition.

@sho-87, thanks for reporting the issue and providing the detailed reproduction steps. If you're still encountering a problem, please let me know with a new Issue or a comment here.

sho-87 commented 3 months ago

awesome! thanks for your speed