orbitalquark / textadept

Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor for programmers.
https://orbitalquark.github.io/textadept
MIT License
649 stars 38 forks source link

Problem expanding snippet with $0 #537

Closed paaguti closed 3 months ago

paaguti commented 3 months ago

I have the following snippet:

snippets.latex.beg = [[\\begin\{${1:env}\}${2:\[${3:opts}\]}
  $0
\\end\{$1\}
]]

If I go to the expansion of the third field, I'm not able to exit the snippet with a tab. However, omitting $0 like this:

snippets.latex.beg = [[\\begin\{${1:env}\}${2:\[${3:opts}\]}
 \end\{$1\}
]]

will allow a tab after entering the third field to exit the snippet.

TA12.4 updated to the latest commit.

orbitalquark commented 3 months ago

Sorry, I'm not able to reproduce this. I was able to tab through all 4 placeholders, ending up between the begin and end tags.

paaguti commented 3 months ago

After more investigation, it happens to be a bit quirky...

It seems to happen when the end of the text you insert in a placeholder is an index in the snippets table:

gnome-shell-screenshot-48gptg

'false' isn't and therefore the snippet exits correctly, bash and python are and an additional tab is required (and hence the blank in the expansion before the ] The = is significant... (see purepythonat the end)... confusing, right?

orbitalquark commented 3 months ago

Wow, thanks so much for taking the time to dig further! I've fixed the bug in https://github.com/orbitalquark/textadept/commit/1567e47c73072beda6dff0e7188f08426ac04e1e.

paaguti commented 3 months ago

Happy to give back :-)