fix: tag parsing truncates emojis with variation selectors (#5496)
This commit is contained in:
parent
ce441644af
commit
3ea6ea3108
2 changed files with 23 additions and 0 deletions
|
|
@ -47,6 +47,17 @@ func isValidTagRune(r rune) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow marks (non-spacing, spacing combining, enclosing)
|
||||||
|
// This covers variation selectors (e.g. VS16 \uFE0F) and combining marks (e.g. Keycap \u20E3, accents)
|
||||||
|
if unicode.IsMark(r) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow Zero Width Joiner (ZWJ) for emoji sequences
|
||||||
|
if r == '\u200D' {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Allow specific ASCII symbols for tag structure
|
// Allow specific ASCII symbols for tag structure
|
||||||
// Underscore: word separation (snake_case)
|
// Underscore: word separation (snake_case)
|
||||||
// Hyphen: word separation (kebab-case)
|
// Hyphen: word separation (kebab-case)
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,18 @@ func TestTagParser(t *testing.T) {
|
||||||
expectedTag: "test🚀",
|
expectedTag: "test🚀",
|
||||||
shouldParse: true,
|
shouldParse: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "emoji with VS16",
|
||||||
|
input: "#test👁️", // Eye + VS16
|
||||||
|
expectedTag: "test👁️",
|
||||||
|
shouldParse: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "emoji with ZWJ sequence",
|
||||||
|
input: "#family👨👩👧👦", // Family ZWJ sequence
|
||||||
|
expectedTag: "family👨👩👧👦",
|
||||||
|
shouldParse: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue