altermo / ultimate-autopair.nvim

A treesitter supported autopairing plugin with extensions, and much more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Incorrect space-surround behaviour with HTML comments

alexmozaidze opened this issue · comments

Bug

When trying to use the following HTML comment custom pair:

{
   "<!--", "-->",
   ft = { "html", "markdown", "vue", "svelte" },
   space = { enable = true },
}

It adds space before the cursor correctly, but after the cursor the space is offset by 1, causing the incorrect behaviour.

Reproduction steps

| is the cursor

  1. Type <!--
<!--|-->
  1. Press <space>
<!-- |- ->

Hacky solution

You surround the pairs manually with spaces:

{
   "<!-- ", " -->", -- Mind the spaces!
   ft = { "html", "markdown", "vue", "svelte" },
}

The problem with this solution is when you successfully make a spaced comment, the spaces in the pair are treated as part of the pair, which means that pressing <space> twice jumps to the end of the pair, and pressing backspace deletes the entire pair along with the spaces inside.

Version info

Neovim

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

ultimate-autopair

branch v0.6
commit 41d8b52

Should be fixed.

Thanks! Could you also enable space for HTML comments now that it works as intended?

Why not.