luukvbaal / statuscol.nvim

Status column plugin that provides a configurable 'statuscolumn' and click handlers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terminal truncation/wrap issue when padding

mehalter opened this issue · comments

There is a weird issue where if there are more than 2 spaces in the statuscolumn string, the terminal truncation breaks.

Here at the end of the line/beginning of the next line the 8 is lost:

2023-10-02_09:48:48_screenshot

Steps to reproduce

  1. Configure statuscol to have padding after both line numbering and fold column
  2. Run :terminal and press i to get into insert mode
  3. Get to over 100 lines by running: for i in $(seq 100); do echo; done
  4. Print numbers enough times to wrap the screen: for i in $(seq 10); do echo -n 1234567890; done; echo

Minimal Configurations

It is a very strange issue and the more I play with it the more I think it's an upstream bug in Neovim calculating when to wrap the line probably calculating the width of the line with a statuscolumn. Here are several configurations that I tried (as lazy.nvim plugin specs):

  1. Default: working, no truncation/wrapping issues
  2. No padding on line number, padding on fold column: working, no truncation/wrapping issues
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C", " " }, click = "v:lua.ScFa" },
          { text = { "%s" }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc, },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },
  1. No padding on foldcolumn or line number, padding on signcolumn: working, no issues
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C" }, click = "v:lua.ScFa" },
          { text = { "%s", " " }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },
  1. Padding on foldcolumn and signcolumn, no line number padding: not working
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C", " " }, click = "v:lua.ScFa" },
          { text = { "%s", " " }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },
  1. Padding on signcolumn and line numbers, no foldcolumn padding: not working
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C" }, click = "v:lua.ScFa" },
          { text = { "%s", " " }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc, " " },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },
  1. Padding on foldcolumn and line number, no signcolumn padding: not working
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C", " " }, click = "v:lua.ScFa" },
          { text = { "%s" }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc, " " },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },
  1. No padding on foldcolumn or signcolumn, but 2 spaces aafter line number: not working
  {
    "luukvbaal/statuscol.nvim",
    lazy = false,
    opts = function()
      local builtin = require "statuscol.builtin"
      return {
        segments = {
          { text = { "%C" }, click = "v:lua.ScFa" },
          { text = { "%s" }, click = "v:lua.ScSa" },
          {
            text = { builtin.lnumfunc, "  " },
            condition = { true, builtin.not_empty },
            click = "v:lua.ScLa",
          },
        },
      }
    end,
  },

Thanks so much for a great plugin and all your work on this! Like I said, I'm like 90% sure it's not a bug here, but just in case I wanted to ask. Also maybe you could help figure out deeper what could be going on in neovim. I haven't been able to reduce this issue to a minimal :set statuscolumn string to report it upstream to core Neovim. If this is misplaced, sorry for the noise!

Actually, I definitely can replicate this with the statuscolumn string "%C%s%l "! I will report this upstream, sorry for the noise here!

Reported upstream if anyone runs into this: neovim/neovim#25472