Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram Desktop displays non-breaking spaces (Unicode U+00A0) in messages as if they were ordinary spaces (Unicode U+0020) #6393

Closed
Mithgol opened this issue Aug 12, 2019 · 3 comments

Comments

@Mithgol
Copy link

Mithgol commented Aug 12, 2019

Steps to reproduce

  1. Close Telegram Desktop on all devices, open Telegram on Android.
  2. Visit “Saved messages”.
  3. Create the following text message: “первый второй третий четвёртый пятый шестой седьмой восьмой девятый десятый одиннадцатый двенадцатый тринадцатый четырнадцатый пятнадцатый” (without quotes).
  4. Replace all ordinary spaces (Unicode U+0020) with non-breaking spaces (Unicode U+00A0) except the five spaces that precede the words “четвёртый”, “седьмой”, “десятый”, “двенадцатый”, “четырнадцатый”. These five must be left intact (i.e. ordinary spaces).
  5. Save the created message in “Saved messages” and close Telegram on Android.
  6. Open Telegram Desktop on Windows.
  7. Ensure that “interface scale” in your Settings is “125%” (otherwise my “Actual behaviour” may slightly differ from yours).
  8. Open the message that was saved on step 5. Alternatively, use https://t.me/ReadMithgol/32 as an example of the message containing the text proposed on step 3.

Expected behaviour

Telegram Desktop should honor the non-breaking properties of non-breaking spaces and thus wrap the lines only where the ordinary spaces are left (i.e. before the words “четвёртый”, “седьмой”, “десятый”, “двенадцатый”, “четырнадцатый”) like Telegram on Android does.

See the message https://t.me/ReadMithgol/33 containing an example screenshot of Telegram on Android. Alternatively, see this image:

(screenshot)

Actual behaviour

Telegram Desktop displays non-breaking spaces (Unicode U+00A0) in messages as if they were ordinary spaces (Unicode U+0020). Telegram Desktop can start a new line of text where a non-breaking space has previously been.

See the message https://t.me/ReadMithgol/34 containing an example screenshot of Telegram Desktop on Windows. Alternatively, see this image:

(screenshot)

Configuration

Operating system: Windows 7 Professional, 64 bit, with Service Pack 1.

Version of Telegram Desktop: 1.8.1, stable.

Used theme: not sure.

Additional notes

  1. The example message has to be composed on Android because Telegram Desktop seems to replace non-breaking spaces (Unicode U+00A0) in messages by ordinary spaces (Unicode U+0020) when the messages are sent or saved.
  2. And that includes drafts saved by other Telegram clients in groups that are open in Telegram Desktop. Hence the “close Telegram Desktop on all devices” in step 1.
  3. A non-breaking space in the message being composed in Telegram Desktop may sometimes trigger a visual bug that looks like a negative indent of the second line of text (if the text is long enough to wrap and if the non-breaking space resides on the second line).
  4. However, all the above notes are probably separate issues. The issue non-breaking space does not work #4193 is also different.
@Mithgol
Copy link
Author

Mithgol commented Sep 23, 2020

The immediate cause of this bug seems to be the result of the following two circumstances:

1️⃣ The bool IsSpace(QChar ch, bool rich) function is defined (in ui/text/text.cpp of desktop-app/lib_ui) to return true for non-breaking spaces.

2️⃣ The Parser::parseCurrentChar() function is defined (in ui/text/text.cpp of desktop-app/lib_ui) to use QChar::Space (instead of the actual incoming character) wherever IsSpace returns true.

Should an additional check for U+00A0 be added to Parser::parseCurrentChar?

Should an additional check for U+00A0 be added to IsSpace?

@stale
Copy link

stale bot commented Mar 22, 2021

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@stale stale bot added the stale label Mar 22, 2021
@stale stale bot closed this as completed Apr 21, 2021
@github-actions
Copy link

github-actions bot commented Jun 5, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants