-
-
Notifications
You must be signed in to change notification settings - Fork 60
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]: Posts overflow their card #756
Comments
It does render correctly in Feditext, and it seems to render fine in their Masto instance UI too, which prompted me to file the bug. |
This is a regression due to #644 (I'll include more info for future reference, but the solution will be to partially revert one of the hacks)
While most other labels have a bound width of ~532, the overflowing one has more than double default: ellipsize + lines 100 hack: default + use-markup false: I can't override most of the functions responsible for calculating the width and I don't want to re-create gtklabel in Vala https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c This is probably the culprit of #719 #632 #626 cc: @bugaevc in case you have any insights |
That was a lot faster and more info than I was expecting, thank you! Seems that's going to be annoying to fix. I'm still curious how it's only posts in that thread that manage to trigger it, but ah well. |
It's very much out of my expertise. It has to do with at least GTK's basic label widget and probably other circumstances that cause the label dimension (bounds) being incorrect. The hack previously used would fix that by setting the label to ellipsize (adds This issue was first brought to my attention on the comments of one of the early Tuba releases 😅 Before removing the hack I did check against those posts that caused it then and didn't seem to be an issue anymore but here we are again! To report it to GTK I need to create at least a simple minimal reproducer but since the circumstances are so narrow (use-markup, larger font and line height, listbox with complicated nested widgets, label-with-widgets etc) it's going to take some time. That's why I tagged Sergey since he is familiar with both Tuba's and GTK's codebases in case he has any insights! |
So FWIW (and I haven't read the details of this issue, yet): we know that So if you can make this into a reproducible test case, that'd help. |
Done! Probably can be simplified further but this did it. FWIW, the stack was the last piece of the puzzle public class ExampleApp : Adw.Application {
public ExampleApp () {
Object (
application_id: "com.example.App",
flags: ApplicationFlags.DEFAULT_FLAGS
);
}
public override void activate () {
var win = new Adw.ApplicationWindow (this);
win.set_default_size (500, 300);
var provider = new Gtk.CssProvider ();
provider.load_from_string (".larger{font-size:larger;line-height:1.4;}.padding{padding:2px;}");
Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
var listbox = new Gtk.ListBox () {
selection_mode = Gtk.SelectionMode.NONE,
css_classes = {"background"}
};
var content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
css_classes = {"card", "padding"},
};
content_box.append (new Gtk.Label ("") {
width_request = 610,
height_request = 34
});
var stack = new Gtk.Stack () {
margin_top = 15,
margin_start = 18,
margin_end = 18,
margin_bottom = 18
};
stack.add_child (new Gtk.Label ("and he <a href='https://en.osm.town/@SK53'>@SK53</a> keeps the momentum with the rarely seen combination of Rwanda 🇷🇼 Romania 🇷🇴 <a href='https://en.osm.town/tags/fridaygeotrivia'>#fridaygeotrivia</a> 👏") {
use_markup = true,
wrap = true,
xalign = 0.0f,
wrap_mode = Pango.WrapMode.WORD_CHAR,
valign = Gtk.Align.START,
ellipsize = Pango.EllipsizeMode.NONE,
css_classes = {"larger"}
});
content_box.append (stack);
listbox.append (content_box);
win.content = new Gtk.ScrolledWindow () {
vexpand = true,
hscrollbar_policy = Gtk.PolicyType.NEVER,
child = new Adw.Clamp () {
child = listbox,
tightening_threshold = 300,
maximum_size = 670,
vexpand = true
}
};
win.present ();
}
public static int main (string[] args) {
var app = new ExampleApp ();
return app.run (args);
}
}
|
Yep, the emojis are important. In fact, everything is important, including the exact characters https://gitlab.gnome.org/GNOME/gtk/-/issues/6637 |
|
I'll flatpak these just so we are on the same environment. Since these are also pango related, make sure you use gnome defaults (font, size) without fractional scaling etc... I finally have some logs:
And making the window larger doesn't seem to fix wrapping now (making it smaller does though) https://github.com/GeopJr/Tuba/tree/experiment/reproducer ( As for nat-lines + ellipsize + wrap: Setting it to 20, seems to ellipsize regardless (disabling ellipsize) One of the measuring issues seems to be fixed https://labyrinth.zone/notice/AgzGZoBtX749xlQGeG the one from this issue seems to be fixed but nat-lines doesn't work like lines did (ellipsizes always on 1 line) so I also disabled ellipsize here https://github.com/GeopJr/Tuba/tree/experiment/nat-lines |
So, two things:
Other than that, this seems to be working great for me actually. No criticals from the box optimization, and the labels seem to behave as intended.
Deckverse: Patting Luna: Rwanda: |
LGTM, overall, nice work! To be honest, I don't think ellipsizing at all is appropriate for Tuba however. It's not just labels, so it can end up as:
|
Describe the bug
For some reasons a number of posts seem to "escape" from the card they're rendered in.
I tried disabling and enabling the increased font size and line height options, but that doesn't change it.
Steps To Reproduce
I don't know exactly how to reproduce it, it just started happening. It's in this thread that it happens: https://en.osm.town/@opencage/111823092381561642. It seems to happen at random and so far it seems to only happen to
@[email protected]
.Logs and/or Screenshots
Instance Backend
GoToSocial
Operating System
Arch Linux
Package
Flatpak
Troubleshooting information
Additional Context
No response
The text was updated successfully, but these errors were encountered: