~ianmjones/snippetexpander#20: 
When two abbreviations contain the same text, expansion doesn't work correctly

If one snippet has an abbreviation that's part of another abbreviation, part of the abbreviation of one snippet will be added with the expanded text of the other snippet. To reproduce:

Enable "Auto expand snippets as they are typed" Create the following snippets with these abbreviations and text

Abbr Text
snp1 First snippet
snp2 Different text
chk
gchk

Note: The black check with chk is UTF8 character \u2713, The green check (which may appear as a check in a box, font depending) is UTF8 character \u2705

This is what happens when I use each abbreviation:

  • snp1 and snp2 expand correctly on Plasma and Budgie (in a text editor)

  • 'chk' expands correctly in gedit on Budgie, but adds a 4 on Plasma in KWrite:
    ✓ 4

  • 'gchk' on Plasma in KWrite expands to
    g✓4
    (so it adds the g from the abbr. and then the text of the other snippet)

  • In gedit / Writer on Budgie 'gchk' expands to
    g✓
    That same green check expands correctly with this snippet: abbr text
    okc - ok ✅

Status
RESOLVED FIXED
Submitter
~traceyc
Assigned to
No-one
Submitted
5 months ago
Updated
5 months ago
Labels
bug

~ianmjones 5 months ago

I can reproduce the problem whereby if an abbreviation ends with another shorter abbreviation, the shorter end abbreviation expands, e.g, with these 2 snippets:

"w`" => "World"

"hw`" => "Hello, World"

Typing "hw`" results in "hWorld" instead of the expected "Hello, World".

That's definitely not how it's supposed to work, it should recognise that there's a longer matching abbreviation and expand that.

Thanks for the bug report (I'll trim out the UTF8 stuff as that's covered by #19).

~ianmjones REPORTED FIXED 5 months ago

Ian M. Jones referenced this ticket in commit b6f9a10.

~ianmjones 5 months ago

This will be in Snippet Expander v1.1.0.

Here's a little demo: https://youtu.be/KClKlQcNDC8

Thanks for the bug report ~traceyc.

Register here or Log in to comment, or comment via email.