Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
2.15k stars 113 forks source link

Markup with Umlauts isn't markupping #308

Closed paulhersch closed 7 months ago

paulhersch commented 7 months ago

Hello :) (No screenshot, because i forgor and switched back to awm for work, can deliver later if needed)

Basically as the description says: as soon as my Markup has Umlauts, it isn't rendering "markupped" but as like the default source string (with the tags). I discovered this as i was creating widgets for my AppLauncher. I tried using GLibs markup escape to mitigate this but it seems like Umlauts aren't escaped. I am a little confused as this isn't a fault in Pango iirc (rendering Umlauts with Pango via PangoCairo in awesome wm works just fine) and it shouldn't be a problem in GTK itself?

relevant code snippet

import GLib from 'gi://GLib'

const EntryWidget = (app) => {
    return Widget.Button({
        class_name: "launcherEntries",
        onPrimaryClick: () => app.launch(),
        child: Widget.Box({
            vertical: false,
            children: [
                Widget.Icon ({
                    icon: app.icon_name,
                    size: 36
                }),
                Widget.Box({
                    vertical: true,
                    vpack: "start",
                    children: [
                        Widget.Label({
                            useMarkup: true,
                            label: `${app.name}`,
                            xalign: 0
                        }),
                        app.description != null ? Widget.Label({
                            useMarkup: true,
                            label: `<span style="italic" alpha="90%" size="small">${GLib.markup_escape_text(app.description, -1)}</span>`,
                            xalign: 0,
                            wrap: false,
                            truncate: 'end'
                        }) : null
                    ]
                })
            ]
        })
    })
}

PS: If you don't know what might cause this and know of a fix immediately i am gonna look into it after my exams :)

kotontrion commented 7 months ago

using GLib.markup_escape_text is unnecessary, as ags will use this automatically, if the provided text is not a valid pango markup. I implemented this to prevent ags from crashing when an invalid markup is provided. The problem was the length calculation. I made a PR which fixes this.

paulhersch commented 7 months ago

Good to know, thanks for the quick reply and PR :) (will keep this open until PR is merged)

Edit: can confirm this fixed my issue, which is already closed, thanks for the quick help :)