Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.89k stars 199 forks source link

Room names are not unescaped in room list if ellipsized #1599

Open CrystalGamma opened 10 months ago

CrystalGamma commented 10 months ago

Describe the bug

HTML/XML escapes in Room names are visible in the room list if they are ellipsized.

To Reproduce

  1. Join a room with '&' or other escaped character in its name. #pine64-nutcracker:matrix.org in my case.
  2. Resize the room list to cut off shortly after the escaped character.
  3. Check the name as displayed in the room list. It contains the truncated escape sequence (&am… in my case)

What happened?

It appears to me that ellipsization is done on the escaped text, even though the unescaped form of the ellipsized text is eventually displayed (note the unused space after the ellipsized text in the case where unescaping does take place).

Expected behavior

Room names should be always be unescaped in the room list. Ellipsization should not be based on the escaped form of the text.

Screenshots

Bad: image

Good (but a lot of free space after the ellipsized text): image

Version

0.11.3

Operating system

Linux

Installation method

Some repository (AUR, homebrew, distribution repository, PPA, etc)

Qt version

No response

C++ compiler

No response

Desktop Environment

KDE

Did you use profiles?

Relevant log output

No response

Backtrace

No response

CrystalGamma commented 10 months ago

The same issue is also present in message previews (the actual message begins with "[I] <":

image

deepbluev7 commented 10 months ago

Yeah, this is because we want to be able to render emojis in the room list and that is hard with the current qt without converting the text to html and with html eliding doesn't work, so we do a dirty substring hack....

CrystalGamma commented 10 months ago

Is it something that would be fixed by using a Qt 6 API, once distros start shipping that (presumably in conjunction with Plasma 6)?

Anyway, knowing this background, if you think this is better tracked somewhere else, feel free to close this issue.