mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-18 22:17:01 +00:00
Moved special text command for lang tags to td_lang.
This commit is contained in:
parent
74f9d0935b
commit
2af3770b29
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/localstorage.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "lang/lang_file_parser.h"
|
||||
#include "lang/lang_tag.h" // kTextCommandLangTag.
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/qthelp_regex.h"
|
||||
|
||||
@ -134,7 +135,7 @@ bool ValueParser::readTag() {
|
||||
|
||||
if (_currentTagReplacer.isEmpty()) {
|
||||
_currentTagReplacer = QString(4, TextCommand);
|
||||
_currentTagReplacer[1] = TextCommandLangTag;
|
||||
_currentTagReplacer[1] = kTextCommandLangTag;
|
||||
}
|
||||
_currentTagReplacer[2] = QChar(0x0020 + _currentTagIndex);
|
||||
|
||||
|
@ -869,19 +869,14 @@ auto ChoosePlural = ChoosePluralDefault;
|
||||
int FindTagReplacementPosition(const QString &original, ushort tag) {
|
||||
for (auto s = original.constData(), ch = s, e = ch + original.size(); ch != e;) {
|
||||
if (*ch == TextCommand) {
|
||||
if (ch + kTagReplacementSize <= e && (ch + 1)->unicode() == TextCommandLangTag && *(ch + 3) == TextCommand) {
|
||||
if (ch + kTagReplacementSize <= e && (ch + 1)->unicode() == kTextCommandLangTag && *(ch + 3) == TextCommand) {
|
||||
if ((ch + 2)->unicode() == 0x0020 + tag) {
|
||||
return ch - s;
|
||||
} else {
|
||||
ch += kTagReplacementSize;
|
||||
}
|
||||
} else {
|
||||
auto next = textSkipCommand(ch, e);
|
||||
if (next == ch) {
|
||||
++ch;
|
||||
} else {
|
||||
ch = next;
|
||||
}
|
||||
++ch;
|
||||
}
|
||||
} else {
|
||||
++ch;
|
||||
|
@ -11,6 +11,7 @@ enum lngtag_count : int;
|
||||
|
||||
namespace Lang {
|
||||
|
||||
inline constexpr auto kTextCommandLangTag = 0x20;
|
||||
constexpr auto kTagReplacementSize = 4;
|
||||
|
||||
int FindTagReplacementPosition(const QString &original, ushort tag);
|
||||
|
Loading…
Reference in New Issue
Block a user