gaoDean / autolist.nvim

Automatic list continuation and formatting for neovim, powered by lua
MIT License
242 stars 5 forks source link

Trailing whitespace created with checkboxes #73

Closed steve21168 closed 1 year ago

steve21168 commented 1 year ago

Hi! Thanks for creating this plugin.

I've noticed one issue that seems to be specific to using checkboxes. The plugin seems to be automatically adding 1 character of whitespace at the end of each checkbox line.

For example this is what it looks like opening a new file and creating a list of checkboxes, and just hitting enter to get to the next one. The first checkbox is okay but after that it will add the whitespace character to each line. Also if I were to remove all those whitespace characters and then add an additional checkbox it would re-add the whitespace to all of those lines:

Screenshot 2023-05-25 at 4 37 04 PM

My configuration

  {
    "gaoDean/autolist.nvim",
    ft = { "markdown", "text", },
    config = function()
      local autolist = require("autolist")
      autolist.setup()
      autolist.create_mapping_hook("i", "<CR>", autolist.new)
      autolist.create_mapping_hook("i", "<Tab>", autolist.indent)
      autolist.create_mapping_hook("i", "<S-Tab>", autolist.indent, "<C-D>")
      autolist.create_mapping_hook("n", "o", autolist.new)
      autolist.create_mapping_hook("n", "O", autolist.new_before)
      autolist.create_mapping_hook("n", ">>", autolist.indent)
      autolist.create_mapping_hook("n", "<<", autolist.indent)
      autolist.create_mapping_hook("n", "<C-r>", autolist.force_recalculate)
      autolist.create_mapping_hook("n", ",x", autolist.invert_entry, "")
    end,
  },
gaoDean commented 1 year ago

Hi, sorry for the extra hassle but could you try switching to #72? (The branch name is refac)

steve21168 commented 1 year ago

Yes that fixed it! I'll use this branch till v3 is officially out. Thank you.

Fyi I was doing some digging, and it was related to this line that you removed: https://github.com/gaoDean/autolist.nvim/pull/72/files#diff-03e15a88f7edcacb502afdc15852f4229c33f5cfa064fd0116d1a9e4bc71bf44L83