diff --git a/Telegram/SourceFiles/countries/countries_instance.cpp b/Telegram/SourceFiles/countries/countries_instance.cpp index 69deb65b1..166e270f2 100644 --- a/Telegram/SourceFiles/countries/countries_instance.cpp +++ b/Telegram/SourceFiles/countries/countries_instance.cpp @@ -397,9 +397,10 @@ FormatResult CountriesInstance::format(FormatArgs args) { } currentPatternPos++; } - if (!args.onlyGroups && (currentPatternPos == pattern.size())) { - result += ' '; - } + // Don't add an extra space to the end. + // if (!args.onlyGroups && (currentPatternPos == pattern.size())) { + // result += ' '; + // } if ((currentPatternPos >= pattern.size()) || (pattern[currentPatternPos] == 'X')) { currentPatternPos++; diff --git a/Telegram/SourceFiles/ui/special_fields.cpp b/Telegram/SourceFiles/ui/special_fields.cpp index 6681be1c9..551577a15 100644 --- a/Telegram/SourceFiles/ui/special_fields.cpp +++ b/Telegram/SourceFiles/ui/special_fields.cpp @@ -158,9 +158,13 @@ void PhonePartInput::correctValue( if (leftInPart) { --leftInPart; } else { - newText += ' '; ++curPart; inPart = curPart < _pattern.size(); + // Don't add an extra space to the end. + if (inPart) { + newText += ' '; + } + leftInPart = inPart ? (_pattern.at(curPart) - 1) : 0; ++oldPos; @@ -389,9 +393,12 @@ void PhoneInput::correctValue( if (leftInPart) { --leftInPart; } else { - newText += ' '; ++curPart; inPart = curPart < _pattern.size(); + // Don't add an extra space to the end. + if (inPart) { + newText += ' '; + } leftInPart = inPart ? (_pattern.at(curPart) - 1) : 0; ++oldPos;