garbas / vim-snipmate

snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim.
www.vim.org/scripts/script.php?script_id=2540
2.01k stars 181 forks source link

Fix substitutions eating characters with selections #302

Closed ajzafar closed 4 months ago

ajzafar commented 5 months ago

Title says it all. They kind of work but not in 100% of cases. Need a sample snippet of exactly where they go wrong.

Originated from #265.

ajzafar commented 4 months ago

The issue I had found with evaluations was actually related to substitutions, not evaluations. If a selection is made that is longer than the first option when the selection stop is first entered, then substitutions will eat characters. Skipping past the selection then revisiting it does not seem to result in this bug.

snippet test
        ${1|foo|foobar|foobarbaz} ${1/o/x} abcdefghij ${2}

I've updated the issue title.

ajzafar commented 4 months ago

This is fixed in d887603. Turns out substitutions are not related at all.

Evaluations are now supported as well.