Simplify CustomEmojiId.
This commit is contained in:
parent
180b0bc517
commit
fbd82ff92b
1 changed files with 7 additions and 8 deletions
|
|
@ -130,13 +130,12 @@ bool IsNewline(QChar ch) {
|
|||
|
||||
[[nodiscard]] uint64 CustomEmojiIdFromLink(QStringView link) {
|
||||
const auto skip = Ui::InputField::kCustomEmojiTagStart.size();
|
||||
if (const auto i = link.indexOf(':', skip + 1); i > 0) {
|
||||
const auto index = link.indexOf('?', skip + 1);
|
||||
return base::StringViewMid(
|
||||
link,
|
||||
skip + 1,
|
||||
i - skip - 1).toULongLong();
|
||||
}
|
||||
return 0;
|
||||
skip,
|
||||
(index <= skip) ? -1 : (index - skip - 1)
|
||||
).toULongLong();
|
||||
}
|
||||
|
||||
[[nodiscard]] QString CheckFullTextTag(
|
||||
|
|
@ -3649,7 +3648,7 @@ QString InputField::CustomEmojiLink(QStringView entityData) {
|
|||
|
||||
QString InputField::CustomEmojiEntityData(QStringView link) {
|
||||
const auto match = qthelp::regex_match(
|
||||
"^(\\d+:\\d+)(\\?|$)",
|
||||
"^(\\d+)(\\?|$)",
|
||||
base::StringViewMid(link, kCustomEmojiTagStart.size()));
|
||||
return match ? match->captured(1) : QString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue