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

Click does not work when multiple character text lists #141

Closed
Susensio opened this issue Sep 25, 2024 · 1 comment
Closed

Click does not work when multiple character text lists #141

Susensio opened this issue Sep 25, 2024 · 1 comment

Comments

@Susensio
Copy link

I'm trying to increase the width of foldcolumn, because nerdicons.

I want to preserve highlight, which I'm managed with
#47

And I want to preserve click behaviour

I've tried:

return {
   { -- statuscol
      "luukvbaal/statuscol.nvim",
      enabled = true,
      lazy = false,
      opts = function(plugin, opts)
         local builtin = require("statuscol.builtin")
         return {
            relculright = false,
            segments = {
               {
                  text = { "%s" },
                  click = "v:lua.ScSa",
               },

               {
                  text = { builtin.foldfunc },
                  click = "v:lua.ScFa",
               },
               {
                  text = { " " },
                  click = "v:lua.ScFa",
                  hl = "FoldColumn"
               },
               {
                  text = { builtin.lnumfunc, " " },
                  condition = { true, builtin.not_empty },
                  click = "v:lua.ScLa",
               },
            },
            ft_ignore = {
               "neo-tree",
               "starter",
               "Outline",
            },
         }
      end,
   },
}

But click behaves iconsistently between the first character and the second. First character works OK, but second never opens fold, always closes another fold more.

I've also tried manually including the highlight in the same block, with no luck

local hl = function(name)
   return function(text)
      return "%#" .. name .. "#" .. text .. "%*"
   end
end

return {
   { -- statuscol
      "luukvbaal/statuscol.nvim",
      enabled = true,
      event = "VeryLazy",
      lazy = false,
      init = function()
      end,
      opts = function(plugin, opts)
         local builtin = require("statuscol.builtin")
         return {
            relculright = false,
            segments = {
               {
                  text = { "%s" },
                  click = "v:lua.ScSa",
               },

               {
                  text = { builtin.foldfunc, hl("FoldColumn") " " },
                  click = "v:lua.ScFa",
               },
               {
                  text = { builtin.lnumfunc, " " },
                  condition = { true, builtin.not_empty },
                  click = "v:lua.ScLa",
               },
            },
            ft_ignore = {
               "neo-tree",
               "starter",
               "Outline",
            },
         }
      end,
   },
}

fold

How can I get a 2 character fold column, properly highlighted and with proper click handler?

@luukvbaal
Copy link
Owner

Thanks for reporting. Updated fold clickhandler to check in front of an empty cell like the sign handler does. The first config u posted should work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants