lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
4.86k stars 186 forks source link

`toggle_current_line_blame` can't turn off `current_line_blame` #1072

Closed icefed closed 2 months ago

icefed commented 2 months ago

Description

Default opts.current_line_blame set to false.

If I turn on current_line_blame use :Gitsigns toggle_current_line_blame or :lua require"gitsigns".toggle_current_line_blame(), it will show virtual text(need move cursor, another issue?), repeat toggle_current_line_blame, still show virtual text if I move cursor, I can not turn it off.

Neovim version

0.10.0

Operating system and version

macos 14

Expected behavior

use toggle_current_line_blame will show virtual text without move cursor after current_line_blame_opts.delay.

repeat toggle_current_line_blame, virtual text will disappear immediately, and I move the cursor it will not show virtual text too.

Actual behavior

...

Minimal config

-- init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "lewis6991/gitsigns.nvim",
    opts = {
      signs = {
        add = { text = "+" },
        change = { text = "~" },
        delete = { text = "_" },
        topdelete = { text = "‾" },
        changedelete = { text = "~" },
        untracked = { text = "┆" },
      },
      current_line_blame_opts = {
        delay = 200,
      },
    },
  },
})

Steps to reproduce

  1. :Gitsigns toggle_current_line_blame -> turn on current_line_blame
  2. :Gitsigns toggle_current_line_blame -> turn off current_line_blame

It still show blame virtual text.

Gitsigns debug messages

No response

Gitsigns cache

No response

lewis6991 commented 2 months ago

I'd appreciate it if you followed the issue template properly. Luckily, this issue was easy to fix.

icefed commented 2 months ago

@lewis6991 Thanks for your work, but it still have a problem that toggle_current_line_blame to turn on current_line_blame will not show virtual text until I move cursor.