Allow middle dot in hashtags.

This commit is contained in:
levlam 2022-01-31 02:19:17 +03:00
parent d3c712e660
commit a4d80c76b3
2 changed files with 2 additions and 1 deletions

View File

@ -318,7 +318,7 @@ static vector<Slice> match_bot_commands(Slice str) {
static bool is_hashtag_letter(uint32 c, UnicodeSimpleCategory &category) {
category = get_unicode_simple_category(c);
if (c == '_' || c == 0x200c) {
if (c == '_' || c == 0x200c || c == 0xb7) {
return true;
}
switch (category) {

View File

@ -109,6 +109,7 @@ TEST(MessageEntities, hashtag) {
check_hashtag(" #" + td::string(255, '1') + "a" + td::string(255, 'b') + "# ", {});
check_hashtag("#a#b #c #d", {"#c", "#d"});
check_hashtag("#test", {"#test"});
check_hashtag("#te·st", {"#te·st"});
check_hashtag(u8"\U0001F604\U0001F604\U0001F604\U0001F604 \U0001F604\U0001F604\U0001F604#" + td::string(200, '1') +
"ООО" + td::string(200, '2'),
{"#" + td::string(200, '1') + "ООО" + td::string(53, '2')});