telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.16k stars 5.19k forks source link

Unified Hashtag Behavior #6668

Open igordata opened 5 years ago

igordata commented 5 years ago

Hi everyone. I'd like to thank all Telegram contributors. I use Telegram as my primary messenger over all my devices. Today it is the main app I use for my work, to chat with friends or even read news. I don't have enough experience with unicode symbols. I hope someone will cast some light upon the unicode usage and regex. But the main idea is to simplify rules that define what is considered as hashtag.

Thanks.

Is your feature request related to a problem?

Some hashtags are not recognized as hashtags: #1111 or #👋 or #௱ Some hashtags are partially recognized and by this broken: #abc(df) Some hashtags are unpredictably divided by a unicode symbol: ગુજરાતી becomes image

Describe the solution you'd like

Hashtag is every sequence of symbols that ends with \s, $ or # only. All the other symbols, including punctuation marks or any possible unicode sequences have to be considered as a hashtag body.

https://github.com/telegramdesktop/tdesktop/blob/ecfe1dacb23d7402255e310cec422b4f9d9a3cc0/Telegram/SourceFiles/ui/text/text_entity.cpp#L70

So \w have to be changed to \S and \W|$ to \s|$

Describe alternatives you've considered

none

Additional context

I found some similar issues

https://github.com/telegramdesktop/tdesktop/issues/6014 https://github.com/telegramdesktop/tdesktop/issues/1529 https://github.com/telegramdesktop/tdesktop/issues/1680

Aokromes commented 5 years ago

numbers is intended.

igordata commented 5 years ago

numbers is intended.

I mean I don't understand why do we have rules that limits the way hashtags are created. I saw several times when people tried to use numeric hashtags.

MasterGroosha commented 5 years ago

@Aokromes but Telegram for Android accepts numeric hashtags. Maybe iOS app as well. EDIT: no, it's just bugged.

igordata commented 5 years ago

Could someone please check it? I don't have an Android phone.

MasterGroosha commented 5 years ago

@igordata I was wrong. Telegram for Android parses numeric hashtags a, well, hashtags only right after you send such message. It becomes clickable until you close and re-open chat. I guess it's a server-side thing then.

stale[bot] commented 3 years ago

Hey there!

This issue will be automatically closed in 7 days if there would be no activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

0xUrsa commented 3 years ago

Soo, u will fix it? Cause it is still not working.

ilya-fedin commented 3 years ago

Soo, u will fix it? Cause it is still not working.

I guess it's wontfix since the regex should be consistent with how the server parses hashtags (i.e. even if the app will start parse these sequences as hashtags, server won't be able to search them and this would look like a bug)