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

[Bug]: A post causes a UI overflow on Tuba App #914

Closed
kop316 opened this issue Apr 18, 2024 · 15 comments · Fixed by #1172
Closed

[Bug]: A post causes a UI overflow on Tuba App #914

kop316 opened this issue Apr 18, 2024 · 15 comments · Fixed by #1172
Labels
bug Something isn't working

Comments

@kop316
Copy link
Contributor

kop316 commented Apr 18, 2024

Describe the bug

Hello!

This post seems to cause an overflow of the UI of the Tuba App: https://akkoma.meows.gay/objects/b0dcc9c5-ece9-49eb-a83a-7c2b8b60c1bd

Screenshot:
Screenshot_2024-04-17_20-40-09

Steps To Reproduce

  1. Follow that account
    1. Have it show up on your Home feed.

Logs and/or Screenshots

<paste your logs here>

Instance Backend

Mastodon

Operating System

Debian Trixie

Package

OS repositories

Troubleshooting information

No response

Additional Context

No response

@kop316 kop316 added the bug Something isn't working label Apr 18, 2024
@GeopJr
Copy link
Owner

GeopJr commented Apr 18, 2024

That's not it (or at least it's doesn't reproduce it here)

In general, the issue is with GtkLabel + ellipsize + wrap measuring the widget size incorrectly. GtkLabels are beyond broken under multiple containers, see this one for another example #756 (comment)

It has been reported again #719 and again #632 and again #626 and many other times, but unless I get the post (or rather label) actually causing it, reproducibly, I can't really do anything, including creating a minimal reproduction so gtk fixes it or a workaround from our side

Finding which one is actually causing it is also somewhat difficult as you have to play around with the inspector until you figure it out, which is likely to crash a few times. I don't expect anyone to go through that but I'm still throwing it out there just in case

@GeopJr
Copy link
Owner

GeopJr commented Apr 18, 2024

Though, from the looks of it you are also using an older version of Tuba, it might have been fixed on 0.7 🤷

@kop316
Copy link
Contributor Author

kop316 commented Apr 18, 2024

Ahh, thanks for that. You are correct, that was the wrong post. I think I found the correct post that causes it: https://fosstodon.org/deck/@[email protected]/112287918084026585

@kop316
Copy link
Contributor Author

kop316 commented Apr 18, 2024

It looks like since this is a duplicate, it doesn't make sense to keep open.

@kop316 kop316 closed this as completed Apr 18, 2024
@GeopJr
Copy link
Owner

GeopJr commented Apr 18, 2024

Thanks for figuring it out!

I'll re-open this as they are mostly case-by-case. I'll see about writing a workaround!

@GeopJr GeopJr reopened this Apr 18, 2024
@GeopJr
Copy link
Owner

GeopJr commented Apr 18, 2024

Okay so, GtkLabel reports a larger min width that natural. This can be fixed by removing the overflow workaround but then we need to fix that. So for now, I'll say blocked by https://gitlab.gnome.org/GNOME/gtk/-/issues/6637 and see how it goes

@Newbytee
Copy link

This post also messes up the layout for me: https://misskey.fryer.net.au/notes/9zi3esm0yk

@GeopJr
Copy link
Owner

GeopJr commented Oct 21, 2024

Can reproduce, thanks!

@GeopJr
Copy link
Owner

GeopJr commented Oct 21, 2024

I'm just going to post this here for future reference:

  • Pango/GtkLabel issue
  • Has to do with GtkLabel's minimum width being > natural width for height, only when there are custom shapes (/ custom emojis)
  • Setting pango wrap to word from word_char seems to fix it, who knows what it broke however 🤷
  • There are already way too many hacks around wrapping to avoid bugs such as https://gitlab.gnome.org/GNOME/gtk/-/issues/6637

@bugaevc
Copy link
Contributor

bugaevc commented Oct 22, 2024

Ahem... I still hope to eventually fix all of this from GTK side, once and for all. But evidently this is taking longer than expected, and I understand that you want to ship a non-broken app now (which I as a user only appreciate).

But please avoid doing anything (e.g.: designing LWW to fundamentally rely on hacks) that would prevent you from just doing the supported, straightforward thing in the future, once GtkLabel is fixed to just work. And please share any feedback (the more the better!) on what GtkLabel behavior/features would actually be useful for you. This was the little piece of feedback that you shared last time, and that was very useful, and caused me to reevaluate how I want this to work.

@GeopJr
Copy link
Owner

GeopJr commented Oct 22, 2024

Thanks, I appreciate all your work on fixing GtkLabel 🙇

As it stands, #1172 is not that big of a deal, it just changes wrapping from word_char to word. It might cause wrapping to not be as nice as it was but it's preferred over having your whole timeline broken just because of a single post

And please share any feedback (the more the better!) on what GtkLabel behavior/features would actually be useful for you.

Well, the obvious one would be, adding custom widgets but... it's a very niche use that is more likely to make GtkLabel even more complex. So the second best solution, would probably be unsealing GtkLabel so I can freely manipulate its aria label and measuring, but I don't think anyone involved will be interested in that 😅

Other than that, if you go deep into pango stuff, <bdi> markup to isolate bi-directional characters would be useful #603, even for gnome-shell #603 (comment)

And RTL languages are not always detected (?) #16, I can't remember the specifics, this was very early in tuba's lifespan, but I ended up using a regex and set xalign manually

@bugaevc
Copy link
Contributor

bugaevc commented Dec 26, 2024

Dumping my findings before I forget: https://labyrinth.zone/notice/AgzGZoBtX749xlQGeG is Pango deciding to ellipsize around an inserted shape (for a custom emoji), which then sets item->num_chars to describe the whole ellipsized part, but then pango_layout_run_get_extents_and_height () -> _pango_shape_get_extents () multiplies the shape's width by that num_chars.

In other words: this is a Pango issue, related to the interaction between ellipsization and shapes (custom emoji). Matthias is the one who has enough understanding of Pango internals required to fix it; it would be great if you could make a simple reproducer that doesn't require all of Tuba — basically just LWW w/ that text — then we could submit the issue report to Pango with the above analysis.

@bugaevc
Copy link
Contributor

bugaevc commented Dec 26, 2024

I wrote a pure Pango reproducer myself: https://gitlab.gnome.org/GNOME/pango/-/issues/836

@bugaevc
Copy link
Contributor

bugaevc commented Dec 27, 2024

🎉 Totally fixed with https://gitlab.gnome.org/GNOME/pango/-/merge_requests/796 (in Pango main):

Screenshot From 2024-12-27 16-41-03
Screenshot From 2024-12-27 16-40-08
Screenshot From 2024-12-27 16-39-35

And very likely wouldn't happen even w/o the Pango fix if you dropped the ellipsization hack due to improvements in GTK layouting.

@GeopJr
Copy link
Owner

GeopJr commented Dec 28, 2024

Lets go!!!! Thank you so much 🙇 I don't think anyone but you would have bothered pushing and fixing these 😅

I notified Fractal some days ago about your work on LWW issues to see if they had any themselves; I think LWW is done for good 🥴 (they only had one but it was a race condition on their side, should be good now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants