mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Simplify correct unicode characters counting.
This commit is contained in:
parent
ec40292cbf
commit
9a25d2c413
4 changed files with 6 additions and 6 deletions
|
@ -7513,7 +7513,7 @@ void HistoryWidget::showPremiumToast(not_null<DocumentData*> document) {
|
|||
}
|
||||
|
||||
void HistoryWidget::checkCharsCount() {
|
||||
_fieldCharsCountManager.setCount(Ui::FieldCharacterCount(_field));
|
||||
_fieldCharsCountManager.setCount(Ui::ComputeFieldCharacterCount(_field));
|
||||
checkCharsLimitation();
|
||||
}
|
||||
|
||||
|
|
|
@ -3268,7 +3268,7 @@ not_null<Ui::RpWidget*> ComposeControls::likeAnimationTarget() const {
|
|||
}
|
||||
|
||||
int ComposeControls::fieldCharacterCount() const {
|
||||
return Ui::FieldCharacterCount(_field);
|
||||
return Ui::ComputeFieldCharacterCount(_field);
|
||||
}
|
||||
|
||||
bool ComposeControls::preventsClose(Fn<void()> &&continueCallback) const {
|
||||
|
@ -3451,7 +3451,8 @@ void ComposeControls::checkCharsLimitation() {
|
|||
const auto maxCaptionSize = !hasMediaWithCaption
|
||||
? MaxMessageSize
|
||||
: Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||
const auto remove = Ui::FieldCharacterCount(_field) - maxCaptionSize;
|
||||
const auto remove = Ui::ComputeFieldCharacterCount(_field)
|
||||
- maxCaptionSize;
|
||||
if (remove > 0) {
|
||||
if (!_charsLimitation) {
|
||||
using namespace Controls;
|
||||
|
|
|
@ -573,8 +573,7 @@ void SetupBio(
|
|||
}
|
||||
changed->fire(*current != text);
|
||||
const auto limit = self->isPremium() ? premiumLimit : defaultLimit;
|
||||
const auto countLeft = limit
|
||||
- bio->lastTextSizeWithoutSurrogatePairsCount();
|
||||
const auto countLeft = limit - Ui::ComputeFieldCharacterCount(bio);
|
||||
countdown->setText(QString::number(countLeft));
|
||||
countdown->setTextColorOverride(
|
||||
countLeft < 0 ? st::boxTextFgError->c : std::optional<QColor>());
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 29bce3f8ff693e0386617dfd550a225d0ff11c5d
|
||||
Subproject commit 179a7ec1c1c4310e1c8c935e466d23cbfbe07221
|
Loading…
Add table
Reference in a new issue