Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multibyte start characters don't work #16

Open
arp242 opened this issue Apr 4, 2018 · 1 comment
Open

Multibyte start characters don't work #16

arp242 opened this issue Apr 4, 2018 · 1 comment

Comments

@arp242
Copy link
Contributor

arp242 commented Apr 4, 2018

Since termIndexes is a []int and some "raw" byte indexes are accessed (e.g. str[t 1] == byte(prefix)), multibyte prefixes won't work. This:

mention.GetTags('🔥', "I'm on 🔥fire!")

Should match fire, but doesn't match anything.

Failing test case:

diff --git i/mention_test.go w/mention_test.go
index 423ed9b..904af66 100644
--- i/mention_test.go
    w/mention_test.go
@@ -139,6  139,9 @@ func (s *MentionSuite) TestGetTags(c *C) {

        // use default terminators
        c.Assert(GetTags('@', "hello @test"), DeepEquals, []Tag{{'@', "test", 6}})
 
        // Test multibyte start characters.
        c.Assert(GetTags('🔥', "I'm on 🔥fire!"), DeepEquals, []Tag{{'🔥', "fire", 6}})
 }

 func BenchmarkGetTags(b *testing.B) {
@gernest
Copy link
Owner

gernest commented Apr 4, 2018

I'm a bit busy , if you don't mind you can help with implementation. I will check this out when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants