Update within_surrogate function

within_surrogate()'s second condition doesn't check for previous surrogate pair being the first (high surrogate) of the pair so it spans over all consecutive surrogates 

From https://t.me/TelethonChat/586037

Co-authored-by: Disk6969 <disk6969@users.noreply.github.com>
This commit is contained in:
Prashant Sengar 2024-01-20 14:26:56 +05:30 committed by GitHub
parent 6187ff7dcb
commit c72e63cf1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,7 +58,7 @@ def within_surrogate(text, index, *, length=None):
return (
1 < index < len(text) and # in bounds
'\ud800' <= text[index - 1] <= '\udfff' and # previous is
'\ud800' <= text[index - 1] <= '\udbff' and # previous is
'\ud800' <= text[index] <= '\udfff' # current is
)